July 05, 2009 [Issue 3137] New: choosing the template declaration for a template instantiation involves more than partial ordering by specialization | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=3137 Summary: choosing the template declaration for a template instantiation involves more than partial ordering by specialization Product: D Version: 1.045 Platform: Other OS/Version: Linux Status: NEW Keywords: spec, wrong-code Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: kamm-removethis@incasoftware.de 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. -- 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