[Issue 24464] New: [REG 2.107.0] CTFE error when trying to allocate an array in betterC mode
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Mar 28 20:30:30 UTC 2024
https://issues.dlang.org/show_bug.cgi?id=24464
Issue ID: 24464
Summary: [REG 2.107.0] CTFE error when trying to allocate an
array in betterC mode
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: betterC, CTFE
Severity: regression
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: spoov0.707 at gmail.com
```
int f()() => new int[](1)[0];
pragma(msg, f());
```
Compiling the code above with DMD 2.106.1 using the command
dmd -c -betterC test.d
produces the correct result
0
Since DMD 2.107.0 the following error gets generated:
test.d(1): Error: expression `new int[](1u)` allocates with the GC and cannot
be used with switch `-betterC`
test.d(2): Error: CTFE failed because of previous errors in `f`
test.d(2): while evaluating `pragma(msg, f())`
--
More information about the Digitalmars-d-bugs
mailing list