Bug 3137 – choosing the template declaration for a template instantiation involves more than partial ordering by specialization

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
Other
OS
Linux
Creation time
2009-07-05T00:34:00Z
Last change time
2014-04-18T09:12:07Z
Keywords
spec, wrong-code
Assigned to
bugzilla
Creator
kamm-removethis
Blocks
3109

Comments

Comment #0 by kamm-removethis — 2009-07-05T00:34:56Z
The spec says The template picked to instantiate is the one that is most specialized that fits the types of the TemplateArgumentList. Determine which is more specialized is done the same way as the C++ partial ordering rules. and the DMD code says something else. For instance template Foo1(T) { pragma(msg, "type"); } template Foo1(alias T) { pragma(msg, "alias"); } alias Foo1!(Object) f1; // alias (type is only match-with-conversions) but template Foo2(T : Object) { pragma(msg, "type"); } template Foo2(alias T) { pragma(msg, "alias"); } alias Foo2!(Object) f2; // type (both match exactly, type is more specialized) See http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=92613 for a thorough description.
Comment #1 by dlang-bugzilla — 2014-02-03T14:34:49Z
*** This issue has been marked as a duplicate of issue 1659 ***