[Issue 2372] Template parameter types given as template parameter inhibits template instantiation + missing line number

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jun 28 02:06:08 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=2372

Simen Kjaeraas <simen.kjaras at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #4 from Simen Kjaeraas <simen.kjaras at gmail.com> ---
Jonathan Marler's code does indeed exhibit the same issue, and gives a small
demonstration of why this will never work in the general case. For a more
explicit demonstration:

void foo(T)(Bar!T value) {}

template Bar(T) {
    alias Bar = string;
}

foo("test"); // What is T?

Clearly, in this case T cannot be determined. Real life examples could be
significantly more complex, and even involve CTFE and string mixins. There's
simply no way to make this work in the language.

--


More information about the Digitalmars-d-bugs mailing list