Bug 14839 – [REG2.068.0-b2] Class with static array of Array!T fails to compile

Status
RESOLVED
Resolution
DUPLICATE
Severity
regression
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-07-27T19:32:00Z
Last change time
2015-07-29T10:00:02Z
Assigned to
nobody
Creator
sludwig

Comments

Comment #0 by sludwig — 2015-07-27T19:32:56Z
This used to compile up to 2.067.1: --- import std.container.array; class Test { Array!int[1] field; } --- On 2.068.0-b2 it yields the following errors: test.d(2): Error: @nogc function 'test.Test.~this' cannot call non-@nogc function 'object.TypeInfo_StaticArray.destroy' test.d(2): Error: 'object.TypeInfo_StaticArray.destroy' is not nothrow test.d(2): Error: destructor 'test.Test.~this' is nothrow yet may throw The reason for the error messages is issue 14838, which is not a regression. However some change in Phobos has made this surface only now, making it effectively a Phobos regression.
Comment #1 by ag0aep6g — 2015-07-28T18:07:34Z
Digger says this introduced the regression: https://github.com/D-Programming-Language/druntime/pull/1181 ("Make .destroy() work with attribute inference") That puts the problem in druntime's destroy. Reduced test case: ---- struct Payload {} struct Impl { Payload _payload; } struct RefCounted() { ~this() { Impl* _refCounted; .destroy(_refCounted._payload); } } class Test { RefCounted!()[1] field; } ----
Comment #2 by code — 2015-07-28T23:07:03Z
No, the problem is that the destructor of the class has wrong attributes inferred b/c the used TypeInfo_StaticArray.destroy has no attributes.
Comment #3 by ag0aep6g — 2015-07-28T23:23:08Z
(In reply to Martin Nowak from comment #2) > No, the problem is that the destructor of the class has wrong attributes > inferred b/c the used TypeInfo_StaticArray.destroy has no attributes. I didn't mean to say that the new destroy code is buggy, just that it triggers the compiler bug. That means, if the compiler bug can't be fixed in reasonable time for 2.068, we could workaround it in destroy, or revert the destroy changes for the release.
Comment #4 by code — 2015-07-29T10:00:02Z
(In reply to ag0aep6g from comment #3) > That means, if the compiler bug can't be fixed in reasonable time for 2.068, > we could workaround it in destroy, or revert the destroy changes for the > release. The destroy change you triggered issue 14838, but it really is unrelated (see example). Reverting the destroy change is the wrong move here. We must replace the TypeInfo.destroy calls in buildDtor. *** This issue has been marked as a duplicate of issue 14838 ***