[Issue 1768] New: CTFE: cant ~= an array literal to an unitinitialized array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 3 01:06:12 PST 2008


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

           Summary: CTFE: cant ~= an array literal to an unitinitialized
                    array
           Product: D
           Version: 1.025
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: clugdbug at yahoo.com.au


The bug is illustrated in case (c). Case (d) shows a workaround: explicitly
initialize the array with [].
---------
char [] foo()
{
   char [] a;
   a ~="abc"; // ok
   char [][] b;
   b ~= "abc"; // ok
   char [][][] c;
   c ~= ["abc", "def"]; // Error: cannot eval at compile time
   char [][][] d = [];
   d ~= ["abc", "def"]; // ok
   return "abc";   
}

const xx = foo();


-- 



More information about the Digitalmars-d-bugs mailing list