http://d.puremagic.com/issues/show_bug.cgi?id=5832

           Summary: Template alias parameters are never successfully
                    pattern matched
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: c...@klickverbot.at


--- Comment #0 from klickverbot <c...@klickverbot.at> 2011-04-10 16:01:57 PDT 
---
The following snippet compiles with latest DMD 2 (0219a5f), but does not behave
as expected:
---
struct Bar(alias v) {}
template isBar(T) {
    static if (is(T _ : Bar!(v), alias v)) {
        enum isBar = true;
    } else {
        enum isBar = false;
    }
}

pragma(msg, isBar!(Bar!1234)); // prints false
---

According to the spec, the second parameter to the is() expression is a
TemplateParameterList, and indeed using a TemplateAliasParameter compiles, but
the type is never matched, i.e. the expression always yields false.

The same phenomenon also occurs when trying to use a specialized template:
---
struct Bar(alias v) {}
template isBar(T) {
    enum isBar = false;
}
template isBar(T : Bar!(v), alias v) {
    enum isBar = true;
}
pragma(msg, isBar!(Bar!1234)); // prints false
---

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to