Code compiles and run fine with LDC but segfault with DMD

ryuukk_ at
Mon Aug 29 21:46:48 UTC 2022

The following code compiles and run fine with LDC, but with DMD 
it compiles and then default at runtime

-- app.d
enum Test {A, B, C}

Test test = Test.A;

extern(C) void main()


-- object.d
// empty for now

`dmd -m64 app.d && ./app.exe` compiles, running it segfault ⛔

`ldc2 -m64 app.d && ./app.exe` compiles, running it works ✅

Now the interesting part

`dmd -g -m64 app.d && ./app.exe` compiles, running it works! ✅

What `-g` does that makes this code compile and work with DMD?

More information about the Digitalmars-d-learn mailing list