D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 13174 - shared ~this() conflicts with this()
Summary: shared ~this() conflicts with this()
Status: RESOLVED DUPLICATE of issue 8295
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 critical
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-21 01:08 UTC by Vlad Levenfeld
Modified: 2016-02-12 17:32 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Vlad Levenfeld 2014-07-21 01:08:26 UTC
I am unable to define a destructor in a struct which may or may not be shared. Possible duplicate of issue #12004, because if Macro's suggestion were followed, it would solve the problem for my use case.

struct Foo
{
	~this () {}
}
struct Bar
{
	shared ~this () {}
}
struct Baz
{
	~this () {}
	shared ~this () {} // source/main.d(44): Error: destructor main.Baz.~this conflicts with destructor main.Baz.~this at source/main.d(43)
}
void main ()
{
	Foo foo;
	shared Bar bar;

	shared Foo s_foo; // source/main.d(51): Error: non-shared method main.Foo.~this is not callable using a shared object
	Bar n_bar; // source/main.d(52): Error: shared method main.Bar.~this is not callable using a non-shared object
}
Comment 1 Marco Leise 2014-10-17 15:01:33 UTC
Yes, that was my exact same problem. I just jumped right to conclusions in issue #12004.
Comment 2 weaselcat 2016-02-12 17:32:44 UTC

*** This issue has been marked as a duplicate of issue 8295 ***