www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7777] New: std.typecons.Typedef problem with global arrays

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

           Summary: std.typecons.Typedef problem with global arrays
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



This D2 code compiles with -d:

typedef double[3] V3;
V3 v1 = [30, 30, -50];
void main() {
    V3 v2 = [30, 30, -50];
}



But this:

import std.typecons: Typedef;
alias Typedef!(double[3]) V3;
V3 v1 = [30, 30, -50]; // error
V3 v2 = V3([30, 30, -50]); // OK
void main() {
    V3 v3 = [30, 30, -50]; // OK
    V3 v4 = V3([30, 30, -50]); // OK
}


with DMD 2.059head gives:

test.d(3): Error: cannot use array to initialize
Typedef!(double[3u],[nan,nan,nan])

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