I'd like to have: version (D_DebugInfo) {} else { version = enableFeatureThatIsAnnoyingWhenDebugging; } Is there a way to know if debug info is being emitted when compiling? "debug is not cutting it because sometimes you really need to debug with or without -debug, and with or without -O. I want -g.