[Issue 22966] New: Inconsistent `shared`attribute for generated destructor
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Apr 1 12:18:14 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=22966
Issue ID: 22966
Summary: Inconsistent `shared`attribute for generated
destructor
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: kinke at gmx.net
The `shared` attribute for a generated destructor seems NOT to depend on the
aggregate alone:
```
struct WithDtor {
int x;
~this() {}
}
struct A {
WithDtor withDtor;
}
struct B {
version (Shared)
shared A a;
else
A a;
}
struct C {
A a;
}
void main() {
B b;
pragma(msg, A.__xdtor.mangleof);
}
```
With DMD v2.099:
```
$ dmd -o- foo.d
_D3mod1A11__fieldDtorMFZv
$ dmd -o- foo.d -version=Shared
_D3mod1A11__fieldDtorMOFZv
```
This leads to linker errors in real-world code.
--
More information about the Digitalmars-d-bugs
mailing list