Thread overview | |||||
---|---|---|---|---|---|
|
March 17, 2014 [Issue 12386] New: Allow using derivatives of IFTI'd types in remaining arguments | ||||
---|---|---|---|---|
| ||||
https://d.puremagic.com/issues/show_bug.cgi?id=12386 Summary: Allow using derivatives of IFTI'd types in remaining arguments Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: thecybershadow@gmail.com --- Comment #0 from Vladimir Panteleev <thecybershadow@gmail.com> 2014-03-17 07:37:26 EET --- //////// 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. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 17, 2014 [Issue 12386] Allow using derivatives of IFTI'd types in remaining arguments | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vladimir Panteleev | https://d.puremagic.com/issues/show_bug.cgi?id=12386 --- Comment #1 from Vladimir Panteleev <thecybershadow@gmail.com> 2014-03-17 07:50:51 EET --- 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)) {} -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 17, 2014 [Issue 12386] Allow using derivatives of IFTI'd types in remaining arguments | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vladimir Panteleev | https://d.puremagic.com/issues/show_bug.cgi?id=12386 --- Comment #2 from Vladimir Panteleev <thecybershadow@gmail.com> 2014-03-17 09:06:58 EET --- 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); } -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation