www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11581] New: Given T..., new T[0] does not work

https://d.puremagic.com/issues/show_bug.cgi?id=11581

           Summary: Given T..., new T[0] does not work
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: luis luismarques.eu


--- Comment #0 from Luís Marques <luis luismarques.eu> 2013-11-22 07:48:34 PST
---
I'm not sure, but this seems a bug:

    class X(T...) if(T.length > 0)
    {
        T[0] foo()
        {
            return new T[0];
        }
    }

    class A : X!A {}

Error: can't have array of (A)

Workaround:

    class X(T...) if(T.length > 0)
    {
        T[0] foo()
        {
            alias T0 = T[0];
            return new T0;
        }
    }

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