Test cases: void test() { struct X { Object get() immutable { return null; } alias get this; } immutable(X) x; Object y; static assert( is(typeof(1?x:y) == Object)); // fails static assert(!is(typeof(1?x:y) == const(Object))); // fails struct A { int[] get() immutable { return null; } alias get this; } immutable(A) a; int[] b; static assert( is(typeof(1?a:b) == int[])); // fails static assert(!is(typeof(1?a:b) == const(int[]))); // fails }
https://github.com/D-Programming-Language/dmd/pull/571
https://github.com/D-Programming-Language/dmd/commit/06fe1ce97ef56cb86821114024c55f8d5fe0073c