The D specification says:

"A ConditionalStatement that has a DebugCondition is called a DebugStatement. DebugStatements have relaxed semantic checks in that pure, @nogc, nothrow and @safe checks are not done. Neither do DebugStatements influence the inference of pure, @nogc, nothrow and @safe attributes."


So it seems under a debug clause you don't have to conform to pure/@nogc/nothrow/@safe.

The immediate question that follow is:

"Is breaking pure/@nogc/nothrow/@safe Undefined Behaviour (UB) in a DebugStatement?"

Would the optimizer -O breaks code that breaks such by virtue of being -debug?

If no (not UB), doesn't this guarantees that no optimizations will ever be performed thanks to pure/@nogc/nothrow/@safe?

Reply via email to