``` > dmd test0154.d test0154.d(6): Error: undefined identifier T ``` ```test0154.d //T compiles:yes //T has-passed:yes //T retval:25 // template value parameter auto foo(T U, T)() { return cast(int) (U + T.sizeof); } int main() { return foo!true() + foo!10() + foo!I(); } enum I = 5; ```
How SDC works for following codes? auto foo(T u, T)() { return typeof(u).stringof; } pragma(msg, foo(1)); // T is deduced to int ... it's reasonable. pragma(msg, foo(1, int)); // typeof(1) is int by default, so it might be accepted pragma(msg, foo(1, long)); // typeof(u) will be long, or conflict happens? pragma(msg, foo(1, double)); // typeof(u) will be double, or conflict happens? pragma(msg, foo(1, string)); // definitely conflicts
Is this supposed to work? Change back to normal if so.
*** Issue 14362 has been marked as a duplicate of this issue. ***
*** Issue 17279 has been marked as a duplicate of this issue. ***
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18963 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB