www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24295] New: [betterC] ICE with new int[]

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

          Issue ID: 24295
           Summary: [betterC] ICE with new int[]
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ice
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dkorpel live.nl

```D
// REQUIRED_ARGS: -betterC
void f()
{
   int[] overlaps = new int[1];
}
```

Trips an assert `assert(ne.lowering)` in e2ir.d:

```
core.exception.AssertError src/dmd/e2ir.d(1253): Assertion failure
----------------
??:? _d_assertp [0x559cfda473d4]
src/dmd/e2ir.d:1253 dmd.backend.el.elem*
dmd.e2ir.toElem(dmd.expression.Expression, ref
dmd.toir.IRState).visitNew(dmd.expression.NewExp) [0x559cfd8da43c]
```

It's supposed to be lowered to a druntime template, but isn't because it's
betterC. GC operations are allowed for CTFE, but it should error when actually
trying to code gen.

--
Dec 21 2023