www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20299] New: checkaction=context no working with temporary

https://issues.dlang.org/show_bug.cgi?id=20299

          Issue ID: 20299
           Summary: checkaction=context no working with temporary
                    destructors
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: moonlightsentinel disroot.org

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 --
Oct 14 2019