Bug 10114 – Some implicit conversions to immutable and shared should be allowed

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-05-17T23:41:00Z
Last change time
2013-05-18T00:26:38Z
Assigned to
nobody
Creator
bugzilla

Comments

Comment #0 by bugzilla — 2013-05-17T23:41:07Z
The following should work: -------------------------- struct S { int a; immutable(int)* p; } struct T { int a; shared(int)* p; } void main() { auto s = S(); immutable(S)*p = &s; // cannot implicitly convert expression // (& s) of type S* to immutable(S)* shared(S)* q = &s; // cannot implicitly convert expression // (& s) of type S* to shared(S)* auto t = T(); shared(T)* r = &t; // cannot implicitly convert expression // (& t) of type T* to shared(T)* } --------------------------- It should also work not only with pointers, but all reference types (such as dynamic arrays).
Comment #1 by bugzilla — 2013-05-18T00:26:38Z
ack, what was I thinking