Bug 6928 – alias this, immutable and common type fail in presence of fields with indirections

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-11-10T08:24:00Z
Last change time
2011-11-15T21:23:26Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
timon.gehr

Comments

Comment #0 by timon.gehr — 2011-11-10T08:24:28Z
T x; struct S{ T get() const {return x;} alias get this; } struct T{int* p;} // p is necessary. immutable(S) s; immutable(T) t; static assert(is(typeof(1? s:t))); // ok. static assert(is(typeof(1? t:s))); // ok. static assert(is(typeof(1? s:t)==typeof(1? t:s))); // fail. void main(){ auto x = 1? t:s; // ok. auto y = 1? s:t; // compile error. } The code should compile fine.
Comment #1 by k.hara.pg — 2011-11-12T06:18:47Z
Comment #2 by bugzilla — 2011-11-15T21:23:26Z