[Issue 24139] New: 'this' corruption in extern(C++) dtor when destructing via TypeInfo_Struct
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Sep 10 13:42:05 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=24139
Issue ID: 24139
Summary: 'this' corruption in extern(C++) dtor when destructing
via TypeInfo_Struct
Product: D
Version: D2
Hardware: x86
OS: All
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: kinke at gmx.net
Iff. the struct itself has no `extern(C++)` linkage, but its destructor. E.g.,
the assertion in line 3 fails for 32-bit x86:
```
struct S1
{
int x;
extern(C++) ~this() { assert(&this == s1); }
}
extern(C++) struct S2
{
int x;
~this() { assert(&this == s2); }
}
S1* s1;
S2* s2;
void main()
{
s1 = new S1;
s2 = new S2;
typeid(s1).destroy(s1);
typeid(s2).destroy(s2);
}
```
--
More information about the Digitalmars-d-bugs
mailing list