This example compiles in 2.056 --- struct A(T) { T func(T)(T rhs) { return rhs; } } void main() { A!(int) a; a.func("test"); } ---
This could certainly be a source of unexpected bugs. Has anybody dug into this?
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; ```
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; } ```
*** Issue 14516 has been marked as a duplicate of this issue. ***
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17533 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB