[Issue 14838] New: Wrong attribute inference for auto-generated class destructor with static array of non-POD type

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jul 27 12:27:55 PDT 2015


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: nobody at puremagic.com
          Reporter: sludwig at 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- at 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

--


More information about the Digitalmars-d-bugs mailing list