Bug 6569 – Template fails to instantiate when alias this is used

Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2011-08-28T14:12:00Z
Last change time
2011-10-23T22:46:19Z
Keywords
rejects-valid
Assigned to
nobody
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2011-08-28T14:12:01Z
enum Type { A, B, } struct Foo {} struct Bar { Foo foo; alias foo this; } void main() { Bar bar; test!(Type.A)(bar); // fail test!(Type.A)(cast(Foo)bar); // ok } void test(Type type)(Foo foo) if (type == Type.A) { } void test(Type type)(Foo foo) // comment out and both run ok if (type == Type.B) { } If you remove the second test() template both instantiations in main() will work, which is very odd.
Comment #1 by k.hara.pg — 2011-10-23T22:46:19Z
*** This issue has been marked as a duplicate of issue 2778 ***