class A {} void main() { immutable(A) b; A c; auto z = true ? b : c; writeln(typeof(z).stringof); } writes Object, which is wrong in a number of ways. The common type of A and immutable(A) is const(A).
PATCH: cast.c, line 1663. Conversion of both types to const needs to occur for classes, as well as for arrays and pointers. else if (t1->ty == Tclass || t2->ty == Tclass) { + if (t1->mod != t2->mod) + { + t1 = t1->mutableOf()->constOf(); + t2 = t2->mutableOf()->constOf(); + t = t1; + goto Lagain; + } while (1) { int i1 = e2->implicitConvTo(t1); int i2 = e1->implicitConvTo(t2);
Fixed DMD2.044.