[Issue 24489] New: GC array allocations during CTFE in -betterC mode is unnecessarily restricted now
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Apr 8 22:45:29 UTC 2024
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 at puremagic.com
Reporter: kipthemudkip at 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
from pull request #15982, the fix for issue 24295.
Thanks!
--
More information about the Digitalmars-d-bugs
mailing list