www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24489] New: GC array allocations during CTFE in -betterC mode

https://issues.dlang.org/show_bug.cgi?id=24489

          Issue ID: 24489
           Summary: GC array allocations during CTFE in -betterC mode is
                    unnecessarily restricted now
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: kipthemudkip yahoo.com

Prior to LDC 1.36.0 (DMD 2.106.1), the following code would compile just fine
with -betterC switched on:

static immutable thing = () {
    int[] result = new int[](3);
    return result;
}();

Now in LDC 1.37.0 (DMD 2.107.1), I get:

Error: expression `new int[](3LU)` allocates with the GC and cannot be used
with switch `-betterC`

I have a feeling the issue is commit 0eb4ea8c48af9c439928b7470b5ecd6c55e3793d


Thanks!

--
Apr 08