[Issue 3137] New: choosing the template declaration for a template instantiation involves more than partial ordering by specialization

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 5 00:34:57 PDT 2009


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 at digitalmars.com
        ReportedBy: kamm-removethis at 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: -------


More information about the Digitalmars-d-bugs mailing list