www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22966] New: Inconsistent `shared`attribute for generated


          Issue ID: 22966
           Summary: Inconsistent `shared`attribute for generated
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: kinke 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;
        A a;

struct C {
    A a;

void main() {
    B b;
    pragma(msg, A.__xdtor.mangleof);

With DMD v2.099:
$ dmd -o- foo.d
$ dmd -o- foo.d -version=Shared

This leads to linker errors in real-world code.

Apr 01 2022