[Issue 18474] New: Postblit not working in shared structs
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Feb 20 16:16:36 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18474
Issue ID: 18474
Summary: Postblit not working in shared structs
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: edi33416 at gmail.com
The postblit for shared struct is not working as expected, as it is not
infering the `shared` attribute.
For the snippet bellow
shared struct A
{
this(this);
}
struct B
{
A a;
}
void main()
{
shared B b1;
auto b2 = b1;
}
the compiler gives the following error:
Error: non-shared method test.B.__fieldPostblit is not callable using a shared
object
The current workaround for this is to define `A` s postblit as
this(shared this);
--
More information about the Digitalmars-d-bugs
mailing list