Bug 14242 – destruction of static arrays with elaborate destructor elements does not propagate attributes
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-03-04T06:20:08Z
Last change time
2019-07-14T04:32:40Z
Keywords
safe
Assigned to
No Owner
Creator
Jakob Ovrum
Comments
Comment #0 by jakobovrum — 2015-03-04T06:20:08Z
This should compile:
--------
struct S
{
~this() @safe {}
}
void main() @safe
{
S[1] arr;
}
--------
test.d(8): Error: safe function 'D main' cannot call system function 'object.TypeInfo.destroy'
--------
Comment #1 by slavo5150 — 2018-03-07T06:04:19Z
This appears to have been fixed in 2.068.2. I cannot reproduce it in the latest compiler (2.079.0) either. Resolving as WORKSFORME.
Comment #2 by ilyayaroshenko — 2019-07-14T04:29:25Z
Does not work at least for nothrow
https://run.dlang.io/is/OHlf2c
import std.stdio;
static interface I { ref double bar() @safe pure nothrow @nogc; }
static abstract class D { int index; }
static class C : D, I
{
double value;
ref double bar() @safe pure nothrow @nogc { return value; }
this(double d) { value = d; }
~this() nothrow {}
}
void main() nothrow
{
auto c = new C(1);
destroy(c);
}
Comment #3 by ilyayaroshenko — 2019-07-14T04:31:08Z
attributes are not propagated for classes destruction.
Comment #4 by ilyayaroshenko — 2019-07-14T04:32:40Z