Issue 17970 - shared struct destructor doesn't compile anymore
Summary: shared struct destructor doesn't compile anymore
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 regression
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-06 15:33 UTC by Radu Racariu
Modified: 2018-02-12 16:39 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 Radu Racariu 2017-11-06 15:33:08 UTC
The following:

+++++foo.d++++++

shared struct Shared
{
    static shared(Shared) make()
    {
      return shared(Shared)();
    }

    ~this()
    {
    }
}

void main()
{
    auto s = Shared.make();
}

+++++++++++

Compiles with 2.072 and 2.074, fails with upward versions including 2.077 with this error:

Error: shared method foo.Shared.~this is not callable using a non-shared object
Comment 2 alex.jercaianu 2018-01-16 10:57:55 UTC
 shared struct Foo
 {
     ~this()
     {
     }
 }

 void main()
 {
     Foo x;
 }

This still does not compile
Comment 3 Atila Neves 2018-01-30 10:02:46 UTC
This doesn't compile either now:

struct Inner { ~this() {} }
struct Outer { shared Inner inner; }
 
void main() {
    Outer _;
}
Comment 5 github-bugzilla 2018-02-12 16:39:13 UTC
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/8a61a31749272ec0ebe10f826ab696510e5ed154
Fix Issue 17970 - shared struct destructor doesn't compile anymore

https://github.com/dlang/dmd/commit/2c70923e3c369148b24c75be6e362c1231ae620a
Merge pull request #7874 from RazvanN7/Issue_17970

Fix Issue 17970 - shared struct destructor doesn't compile anymore
merged-on-behalf-of: Andrei Alexandrescu <andralex@users.noreply.github.com>