www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24365] New: ICE when printing 'showCtfeContext' error

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

          Issue ID: 24365
           Summary: ICE when printing 'showCtfeContext' error
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ice
          Severity: normal
          Priority: P3
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dkorpel live.nl

Found while adding a test case to core.demangle.

```
void main()
{
    enum r = () {
        void f();
        f();
        return 2;
    }();
    static assert(r == 2);
}
```

The enum gets set to an `EXP.showCtfeContext` expression, which trips an assert
when printed in the static assert failure:

```
Error: incompatible types for `(<error>) == (3)`: `void` and `int`
error: EXP 121 has no string
precedence not defined for token 'XXXXX'
(...)
src/dmd/hdrgen.d:3668 void dmd.hdrgen.expToBuffer(dmd.expression.Expression,
dmd.parse.PREC, ref dmd.common.outbuffer.OutBuffer, ref dmd.hdrgen.HdrGenState)
[0x6441f093586f]
```

--
Feb 01