Bug 24464 – [REG 2.107.0] CTFE error when trying to allocate an array in betterC mode

Status
NEW
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2024-03-28T20:30:30Z
Last change time
2024-12-13T19:34:16Z
Keywords
betterC, CTFE
Assigned to
No Owner
Creator
Spoov
Moved to GitHub: dmd#20429 →

Comments

Comment #0 by spoov0.707 — 2024-03-28T20:30:30Z
``` 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())`
Comment #1 by robert.schadek — 2024-12-13T19:34:16Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20429 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB