[Issue 6879] New: The difference of between template matching and IsExp

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 2 04:57:29 PDT 2011


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

           Summary: The difference of between template matching and IsExp
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: k.hara.pg at gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2011-11-02 04:57:00 PDT ---
I think following code should compile.

----
private template isStaticArray(T : U[N], U, size_t N)
{
    enum bool isStaticArray = true;
}
private template isStaticArray(T)
{
    enum bool isStaticArray = false;
}

void main()
{
    alias int[3] T;

    enum res1 = isStaticArray!T;

    static if (is(T _ : U[N], U, size_t N))
        enum res2 = true;
    else
        enum res2 = false;

    static assert(res1 == res2);   // fails... Why?
}

-- 
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