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

          Issue ID: 14838
           Summary: Wrong attribute inference for auto-generated class
                    destructor with static array of non-POD type
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nob...@puremagic.com
          Reporter: slud...@outerproduct.org

When a class contains a field that is a static array of a type that has a
destructor, the attributes for the auto-generated class destructor are not
correctly inferred and it fails to compile:

---
struct Array(T) { ~this() {} }
class Test { Array!int[1] array; }
---

Error: pure function 'test.Test.~this' cannot call impure function
'object.TypeI
nfo.destroy'
test.d(2): Error: safe function 'test.Test.~this' cannot call system function
'o
bject.TypeInfo.destroy'
test.d(2): Error: @nogc function 'test.Test.~this' cannot call non-@nogc
functio
n 'object.TypeInfo.destroy'
test.d(2): Error: 'object.TypeInfo.destroy' is not nothrow
test.d(2): Error: destructor 'test.Test.~this' is nothrow yet may throw

--

Reply via email to