Tested with DMD 2.053. Took me some time to reduce this: A.d: import B; void main(){foo();} B.d int bar(){switch(0){};} // any switch statement that does not compile will do. auto foo(){static if(__traits(compiles,{enum x=bar();})){}} This code provokes an internal compiler error: $ dmd A B dmd: statement.c:2758: virtual Statement* SwitchStatement::semantic(Scope*): Assertion `!cases' failed. Aborted
*** This issue has been marked as a duplicate of issue 5453 ***