On Wednesday, 1 March 2017 at 09:19:53 UTC, Christian Köstlin wrote:
On 01/03/2017 00:09, Joseph Rushton Wakeling wrote:
if (!__ctfe) assert(false);

... might be the best option. That shouldn't be compiled out even in -release builds.
thats a nice idea! is this happening because of assert(false) being always part of release builds (as mentioned here: https://dlang.org/spec/contracts.html#assert_contracts) or because the if would have no instructions anymore if this is removed.

Yes assert(false) or assert(0) is a special case according to the specification. At least in the DMD implementation it is not removed for -release. If reached it throws an "object.Error@(0): assert(0) or HLT instruction" instead of core.exception.AssertError

Reply via email to