www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12834] New: implicite destructor cannot call invariant


          Issue ID: 12834
           Summary: implicite destructor cannot call invariant
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: r.sagitario gmx.de

Compile this code with "dmd test.d":

struct Treap(E)

class P

    Treap!int ranges;

It yields:

Error: pure function 'test.P.~this' cannot call impure function
test.d(9): Error: safe function 'test.P.~this' cannot call system function
test.d(9): Error:  nogc function 'test.P.~this' cannot call non- nogc function

It seems the attributes are inferred without the invariant. Annotatibg the
invariant with " nogc pure nothrow const" can work, but get's viral if you call
other functions.

This came up when trying to enable debug(INVARIANT) in gc.d. I failed to add
appropriate annotation there, because you cannot overload on  nogc.

Jun 01 2014