alias Foo(T) = T;
struct Test(T, Foo!T t) {}
unittest {
Test!(int, 3) a;
}
foo.d(2): Error: alias T = T; cannot alias itself, use a qualified name to create an overload set
Comment #1 by b2.temp — 2020-07-04T19:01:08Z
This is more a bad diagnostic. The real problem being that the previous template params cannot be reused, e.g
---
alias Foo(T) = T;
struct Test(T, Foo!(T[]) t) {}
void main()
{
Test!(int, [3]) a;
}
---
Comment #2 by simen.kjaras — 2020-07-05T15:30:15Z
Works better if Foo's parameter is called something else:
alias Foo(U) = U; // undefined identifier T
Obviously you're right about the real problem, and the error message is a case of bad diagnostic. However, I think you should be allowed to reuse the previous template params.
Comment #3 by robert.schadek — 2024-12-13T18:59:36Z