You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
struct A { int a; }
void g()
{
shared A a;
A b;
a=b; //converts
assert(a==b); //fail
}
Error: incompatible types for ((a) is (b)): 'shared(A)' and 'A'
Works for immutable. Is it an oversight?
The text was updated successfully, but these errors were encountered:
I don't think this is an oversight. The table at https://dlang.org/spec/const3.html in section 18.11 says that shared cannot be implicitly converted to mutable. The same code as yours with b marked immutable works. I do think this behaviour is a little surprising.
anonymous4 reported this on 2017-09-28T10:49:26Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=17864
CC List
Description
struct A { int a; } void g() { shared A a; A b; a=b; //converts assert(a==b); //fail } Error: incompatible types for ((a) is (b)): 'shared(A)' and 'A' Works for immutable. Is it an oversight?The text was updated successfully, but these errors were encountered: