← Back to index
|
Original Bugzilla link
Bug 8266 – Calling a function in pseudo-member syntax fails to deduce template argument type that uses alias this
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-06-19T06:46:00Z
Last change time
2012-06-20T00:35:15Z
Assigned to
nobody
Creator
tommitissari
Comments
Comment #0
by tommitissari — 2012-06-19T06:46:09Z
module main; struct MyStruct { int _value; } struct MyStructWithAliasThis { int _value; alias _value this; } int main(string[] argv) { int n; float f; MyStruct ms; MyStructWithAliasThis mswat; assertTypesAreSame!(int)(n); // #0: OK n.assertTypesAreSame!(int)(); // #1: OK assertTypesAreSame!(float)(f); // #2: OK f.assertTypesAreSame!(float)(); // #3: OK assertTypesAreSame!(MyStruct)(ms); // #4: OK ms.assertTypesAreSame!(MyStruct)(); // #5: OK assertTypesAreSame!(MyStructWithAliasThis)(mswat); // #6: OK mswat.assertTypesAreSame!(MyStructWithAliasThis)(); // #7 return 0; } void assertTypesAreSame(T1, T2)(T2 t2) { static assert(is(T1 == T2)); // #8 } // #7: instantiated from here: assertTypesAreSame!(MyStructWithAliasThis,int) // #8: Error: static assert (is(MyStructWithAliasThis == int)) is false
Comment #1
by k.hara.pg — 2012-06-20T00:35:15Z
Works in 2.060head.