www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24380] New: CTFE assert messages are replaced with "null"

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

          Issue ID: 24380
           Summary: CTFE assert messages are replaced with "null" with
                    -dip1008
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: zorael gmail.com

EndeavourOS/Arch x86_64, dmd 2.107.0, ldc 1.36.0, also 1.37.0-beta1.

The messages of asserts thrown during CTFE are replaced with "null" iff they
were derived from a thrown exception's message and iff the program is built
with -dip1008 enabled.

```d

/+ dub.sdl:
    name "app"
    dflags "-dip1008"
+/

void main() {}

static immutable ctfeThing =
{
    try
    {
        throw new Exception("message");
    }
    catch (Exception e)
    {
        assert(0, e.msg);
    }
    return 0;
}();
```

```
app.d(17,9): Error: null
app.d(20,2):        called from here: `(*function () pure nothrow  nogc  safe
=> 0)()`
Error /usr/bin/dmd failed with exit code 1.
```

Expected is "Error: message", and you do get that if you disable -dip1008.

--
Feb 09