Bug 12386 – Allow using derivatives of IFTI'd types in remaining arguments

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-03-16T22:37:26Z
Last change time
2024-12-13T18:18:25Z
Assigned to
No Owner
Creator
Vladimir Panteleev
Moved to GitHub: dmd#18797 →

Comments

Comment #0 by dlang-bugzilla — 2014-03-16T22:37:26Z
//////// test.d //////// alias X(T) = T; void f(T)(T a, X!T b) {} void main() { f(5, 5); } //////////////////////// Once the compiler knows what type T is, it can also know what X!T is.
Comment #1 by dlang-bugzilla — 2014-03-16T22:50:51Z
This doesn't work as one might expect: void f(T, U=X!T)(T a, U b) {} U will always be inferred from the type of b, overriding the default. Valid workaround: void f(T, U)(T a, U b) if(is(U==X!T)) {}
Comment #2 by dlang-bugzilla — 2014-03-17T00:06:58Z
The above workaround doesn't work for certain cases: alias X(T) = T; void f(T, U)(T a, U b) if(is(U : X!T)) { } void main() { ubyte b = 5; f(b, 5); }
Comment #3 by hsteoh — 2014-09-25T20:25:33Z
Related: issue #10228
Comment #4 by robert.schadek — 2024-12-13T18:18:25Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18797 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB