Tested with DMD 2.056 shared int* x; immutable int* y; const int* z; static assert(is(typeof(1?x:y) == shared(const(int))*)); // fail. static assert(!is(typeof(1?x:y) == const(int)*)); // fail. static assert(is(typeof(1?x:z) == shared(const(int))*)); // fail. static assert(!is(typeof(1?x:z) == const(int)*)); // fail. All static assertions should pass.
Oops. Obviously x and z should not have a common type at all. So the third static assertion should not pass. (it currently fails for the wrong reason though). Replace the test with this: shared int* x; immutable int* y; const int* z; static assert(is(typeof(1?x:y) == shared(const(int))*)); // fail static assert(!is(typeof(1?x:y) == const(int)*)); // fail static assert(!is(typeof(1?x:z))); // fail shared int[] a; immutable int[] b; const int[] c; static assert(is(typeof(1?a:b) == shared(const(int))[])); // pass (ok) static assert(!is(typeof(1?a:b) == const(int)[])); // pass (ok) static assert(!is(typeof(1?x:z))); // fail All of these should pass.
... static assert(!is(typeof(1?a:c))); // fail
inout is buggy too: inout and shared are combined to shared const. inout(int[]) foo(inout int[] x, shared int[] y, inout int* a, shared int* b){ static assert(!is(typeof(1?x:y))); // fail static assert(!is(typeof(1?a:b))); // fail return x; } Both assertions should pass.
https://github.com/D-Programming-Language/dmd/pull/571
https://github.com/D-Programming-Language/dmd/commit/06fe1ce97ef56cb86821114024c55f8d5fe0073c