DMD should not detect sema errors in e2ir

user1234 user1234 at 12.de
Thu Apr 23 11:31:28 UTC 2026


Little short story.

While reviewing what is going on for another PL, I've noticed 
that people involved were talking about casting string literals 
to integer types, e.g "abcd" can fit in an `uint`.

Tested in D and while the rejection was obvious I've noticed that 
the error message mention "e2ir", which IIRC seems to be a "late 
pass" or a "post-semantic pass".

This is bad for DMD as a library, and I would recommend you to 
move that to expsema instead. Is there are reason why it is done 
in e2ir ? That looks curious.

Beside my new find, there's already

- https://github.com/dlang/dmd/issues/20456
- https://github.com/dlang/dmd/issues/20390
- https://github.com/dlang/dmd/issues/18345

each time a cast is involved and the detection is late.

New find is

```d
void main()
{
     //uint frontEndErr = "abcd"; // not detected in e2ir
     auto middleEndErr  = cast(uint) "abcd"; // e2ir
}
```

That's a minor issue tho.

Have a nice D.


More information about the Digitalmars-d mailing list