Tested with DMD 2.056. const(int[]) x; const(int)[] y; static assert(is(typeof(1?x:y) == typeof(1?y:x))); // fail. Error: static assert (is(const(int)[] == const(int[]))) is false The static assertion should pass. I suggest the common type in this case should be const(int)[]. That is consistent with how type combination works for basic types.
Isn't this more a problem with type inference in the ternary '?' operator?
(In reply to hsteoh from comment #1) > Isn't this more a problem with type inference in the ternary '?' operator? Yes. The ternary operator currently, incorrectly uses the type of its last argument rather than the common type of the second and third arguments. It's essentially the same bug as issue# 3543, but this is with arrays, whereas 3543 specifically talks about classes and interfaces, so I'm not sure if it's actually a duplicate.
Recently Kenji fixed array type deduction to work correctly with base classes. But I guess it still doesn't work properly with common interfaces, or, in this case, const-ness.
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18380 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB