March 11, 2012 [Issue 7686] New: template argument ignored with specialization for dependent parameter | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=7686 Summary: template argument ignored with specialization for dependent parameter Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: dawg@dawgfoto.de --- Comment #0 from dawg@dawgfoto.de 2012-03-11 09:58:11 PDT --- cat > bug.d << CODE struct Pair(T1, T2) {} template foo(T : Pair!(T, U), U) { pragma(msg, "foo ", T, U); } template bar(T : Pair!(T, U), U:int) { pragma(msg, "bar ", T, U); } static assert(!__traits(compiles, foo!(Pair!(double, short), int))); // OK static assert(!__traits(compiles, bar!(Pair!(double, short), int))); // fails CODE dmd -c bug -------- For bar the argument to U is ignored and U is deduced from Pair. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 11, 2012 [Issue 7686] template argument ignored with specialization for dependent parameter | ||||
---|---|---|---|---|
| ||||
Posted in reply to dawg@dawgfoto.de | http://d.puremagic.com/issues/show_bug.cgi?id=7686 --- Comment #1 from dawg@dawgfoto.de 2012-03-11 11:48:11 PDT --- cat > bug.d << CODE struct Pair(T1, T2) {} template foo(T : Pair!(T, U), U) { enum val = 0; } template foo(T : Pair!(T, U), U:int) { enum val = 1; } static assert(foo!(Pair!(int, int)).val == 1); // FAIL - matches both static assert(foo!(Pair!(int, short)).val == 1); // FAIL - matches the first static assert(foo!(Pair!(int, float)).val == 0); // OK - matches the first CODE dmd -c bug -------- This also behaves incorrect for specialized overloads. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation