Thread overview
[Issue 6980] Disallow shadowing template parameters
Dec 17, 2022
Iain Buclaw
Dec 12, 2023
Bolpat
Dec 13, 2023
Basile-z
Dec 13, 2023
Basile-z
Dec 16, 2023
Basile-z
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=6980

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P4

--
December 12, 2023
https://issues.dlang.org/show_bug.cgi?id=6980

Bolpat <qs.il.paperinik@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |qs.il.paperinik@gmail.com

--- Comment #2 from Bolpat <qs.il.paperinik@gmail.com> ---
The general sense of when shadowing a symbol is an error or not is if the symbol has an unambiguous way to be referenced. This expectation is broken when template parameters are shadowed:

```d
struct S(T)
{
    alias T = int; // no error!?
    T x;
    pragma(msg, typeof(x)); // int
}
S!double unused;
```

--
December 13, 2023
https://issues.dlang.org/show_bug.cgi?id=6980

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
                 CC|                            |b2.temp@gmx.com
           Hardware|Other                       |All
                 OS|Windows                     |All

--- Comment #3 from Basile-z <b2.temp@gmx.com> ---
This is a bug given that you cant select the first definition.

However, this should works when T is an alias template parameter and that T is either a function or an overload set.

That is not the case now:

```d
struct S(alias T)
{
    alias T = (int) => 0;

    void test()
    {
        T(0.1); // Error: function literal `__lambda3(int __param_0)` is not
callable
                // using argument types `(double)`

        T(1);
    }
}

void main(string[] args)
{
    S!((float) => 0) s1;
}
```

--
December 13, 2023
https://issues.dlang.org/show_bug.cgi?id=6980

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|enhancement                 |normal

--
December 16, 2023
https://issues.dlang.org/show_bug.cgi?id=6980

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei@erdani.com

--- Comment #4 from Basile-z <b2.temp@gmx.com> ---
*** Issue 14516 has been marked as a duplicate of this issue. ***

--