www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21213] New: preview=dtorfields with strict attributes in base


          Issue ID: 21213
           Summary: preview=dtorfields with strict attributes in base
                    class constructor
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: moonlightsentinel disroot.org

The following test case doesn't compile with `-preview=dtorfields`:


class Parent
    this() nothrow pure  nogc  safe {}

class Child : Parent
    S s;
    // this() {} // Uncomment this to make the test pass

struct S
    ~this() {}


onlineapp.d(6): Error: `pure` constructor `onlineapp.Child.this` cannot call
impure destructor `onlineapp.Child.~this`
onlineapp.d(6): Error: ` safe` constructor `onlineapp.Child.this` cannot call
` system` destructor `onlineapp.Child.~this`
onlineapp.d(6):        `onlineapp.Child.~this` is declared here
onlineapp.d(6): Error: ` nogc` constructor `onlineapp.Child.this` cannot call
non- nogc destructor `onlineapp.Child.~this`

Aug 31 2020