[Issue 5126] New: is expression: matched variadic arguments get empty

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 27 14:53:57 PDT 2010


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

           Summary: is expression: matched variadic arguments get empty
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: wrong-code
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: rsinfu at gmail.com


--- Comment #0 from Shin Fujishiro <rsinfu at gmail.com> 2010-10-27 14:53:08 PDT ---
Pattern matching against template variadic arguments was fixed in bug 2725 and
now works, but there's still a problem.  The matched arguments don't get
correctly aliased:
--------------------
struct Test(T...) {}

void main()
{
    alias Test!(int, double, string) Test1;

    static if (is(Test1 _ : Test!U, U...))
    {
        static assert(U.length == 3, U.stringof);   // (9)
    }
}
--------------------
% dmd -o- -c test.d
test.d(9): Error: static assert  "()"c
--------------------

It works fine if U is not variadic:
--------------------
struct Test(int n) {}

void main()
{
    alias Test!100 Test1;

    static if (is(Test1 _ : Test!n, int n))
    {
        static assert(n == 100);    // fine
    }
    else static assert(0);
}
--------------------

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