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

--- Comment #8 from Adam D. Ruppe <[email protected]> ---
My view is that the code compiles just fine. Just without druntime linked in or
generated typeinfo, or whatever it depends on at run time, it will not link.

The -betterC switch tries to detect these these would-be linker errors and
report them ahead of time, in the compile step, for more consistent and
user-friendly errors.

Since an `if(__ctfe)` branch (or `mixin` or `pragma(msg)` or any other
unambiguously* compile-time only area) is never actually involved in code
generation, that linker error will never actually happen... and the compiler
*should* know that and not cause the ahead-of-time compile error eiter.

* __traits(compiles) (and is(typeof())) is a grey area. Technically it isn't
generating code at all and thus should not generate a linker error, and thus
not generate the betterC error.... but given how it is used in practice I think
it should assume the stuff inside WILL be used for codegen and thus return
false in these cases.

But when in doubt, I say `-betterC` should aim to give the same end result as
`-defaultlib=` just with compile errors instead of linker undefined symbol
errors.

--

Reply via email to