www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14838] New: Wrong attribute inference for auto-generated


          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 puremagic.com
          Reporter: sludwig 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
test.d(2): Error: safe function 'test.Test.~this' cannot call system function
test.d(2): Error:  nogc function 'test.Test.~this' cannot call non- nogc
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

Jul 27 2015