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!
Comment #1 by robert.schadek — 2024-12-13T19:34:31Z