Issue 17658 - Shared postblits and dtors conflict with non-shared versions
Summary: Shared postblits and dtors conflict with non-shared versions
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 major
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks: 16535
  Show dependency treegraph
 
Reported: 2017-07-17 12:25 UTC by Jack Stouffer
Modified: 2022-12-17 10:38 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Jack Stouffer 2017-07-17 12:25:46 UTC
Unlike the ctor, dtors and postblits cannot be overloaded with a shared version that gets called on shared instantiations.

The main problem with this is that making any non-trivial struct work with shared is now impossible, and the user has to make a new struct that's marked with shared on the signature.

==================
struct A
{
    this(string a) {}
    this(string a) shared {}

    ~this() {}
    ~this() shared {}

    this(this) {}
    this(this) shared {}
}

void main()
{
    shared f = A("");
}
==================

Gives

/d422/f152.d(7): Error: destructor f152.A.~this conflicts with destructor f152.A.~this at /d422/f152.d(6)
/d422/f152.d(10): Error: function f152.A.__postblit conflicts with function f152.A.__postblit at /d422/f152.d(9)