Does dmd not always compile all of the source code?

Adam D. Ruppe destructionator at gmail.com
Thu Dec 7 17:14:07 UTC 2017


On Wednesday, 6 December 2017 at 16:07:41 UTC, A Guy With a 
Question wrote:
> Does dmd not compile all source code?

It doesn't. I like to build with a few different options to 
explicitly test (e.g. build for Windows and Linux and -m32 and 
-m64 to ensure those all  exercised) and for templates, do a 
-unittest that actually runs it - e.g. instantiate Array!int - to 
make sure that works and compile with -unittest every so often 
too. Might also do a `__traits(compiles` or static assert on it 
too.

Others have explained why this is, but this is a simple way to 
ensure it compiles at least in some cases to catch typos like 
this.

Another worry btw: the opDispatch feature will just say `no such 
property` if it fails to compile its innards. A test might also 
want to call it explicitly to force error messages.


More information about the Digitalmars-d-learn mailing list