Bug 20299 – checkaction=context not working with temporary destructors
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-10-14T13:31:18Z
Last change time
2019-10-21T13:51:44Z
Keywords
pull
Assigned to
No Owner
Creator
moonlightsentinel
Comments
Comment #0 by moonlightsentinel — 2019-10-14T13:31:18Z
Asserts with temporary values dont compile with -checkaction=context if they have an desctructor which is not [ @nogc @safe nothrow pure ].
------------------------------------------
module check;
struct Bad {
~this() @system {}
}
void main() {
assert(Bad() == Bad());
}
------------------------------------------
dmd -c -checkaction=context check.d
> pure function _d_assert_fail cannot call impure destructor check.Bad.~this
> @safe function _d_assert_fail cannot call @system destructor check.Bad.~this
> @nogc function _d_assert_fail cannot call non-@nogc destructor check.Bad.~this
> nothrow function _d_assert_fail may throw; destructor check.Bad.~this is not nothrow
------------------------------------------
This is caused by the explicit attributes (@nogc @safe nothrow pure) on __d_assert_fail introduced
[1].
[1] https://github.com/dlang/druntime/pull/2479
Comment #1 by dlang-bot — 2019-10-14T14:26:24Z
@MoonlightSentinel created dlang/druntime pull request #2832 "Fix Issue 20299: checkaction=context not working with temporary destr…" fixing this issue:
- Fix Issue 20299: checkaction=context not working with temporary destructors
https://github.com/dlang/druntime/pull/2832
Comment #2 by dlang-bot — 2019-10-21T13:51:44Z
dlang/druntime pull request #2832 "Fix Issue 20299: checkaction=context not working with temporary destr…" was merged into master:
- c3b3a8b3b32fb5adac6f572c6fae6c2e5fef6b5e by MoonlightSentinel:
Fix Issue 20299: checkaction=context not working with temporary destructors
https://github.com/dlang/druntime/pull/2832