void main() { dchar c; pragma(msg, typeof(true ? c : ' ')); } DMD 2.064alpha prints: uint Expected: dchar That bad type unification causes situations like: import std.stdio: writeln; import std.algorithm: map; void main() { "just 1256 some text" .map!(c => true ? c : ' ') .writeln; } That prints: [106, 117, 115, 116, 32, 49, 50, 53, 54, 32, 115, 111, 109, 101, 32, 116, 101, 120, 116]
See also Issue 10926
If you have char c; dchar d; I agree that (true ? d : ' ') should be a dchar, but only because ' ' can be implicitly converted to dchar by applying value range propagation. But (true ? d : c) should not. It's reasonable for it to be a uint. Because c might be a UTF8 code point, not a character, so casting it to a dchar would be incorrect.
Don is correct.