https://issues.dlang.org/show_bug.cgi?id=21471
[email protected] changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] | |rg --- Comment #1 from [email protected] --- Another self-contained example (without druntime & explicit -inline): ============= object.d ================= void main() { auto c = 0; assert(isClose(c, exp(1))); } pragma(inline, true) real exp(real x) pure nothrow { return x; } bool isClose(int lhs, real rhs) pure nothrow { return false; } alias string = immutable(char)[]; string _d_assert_fail(A)(string, A); =========================================== The assertion failure depends on three things: 1. generate debug infos (-g) 2. inlined function call as a paramter 3. node side effects => no temporary For example: assert(isClose(c, exp(1))); is rewritten to assert(isClose(c, exp(1)), _d_assert_fail!bool("", isClose(c, exp(1))); and inlined to assert(isClose(c, ((real x = 1.0L;) , x), 0), _d_assert_fail("", isClose(c, ((real x = 1.0L;) , x), 0))); The problem are the two temporaries x, inserting the second x into the debug info triggers the assertion failure. Debug generation fails only for `-checkaction=context`, manually compiling the lowered expression suceeds without errors. This indicates that the failure is caused by -checkaction=context re-using the same AST node for the call to _d_assert_fail. Copying the CallExp resolves this issue (not sure if that is the best solution). --
