Suppose we have two modules test1 and test2: module test1; version(asdf) {} else { static assert(0); } module test2; version = asdf; import test1; This won't compile. Is there a way to get the intended behavior without passing the versions on the command line?