[Issue 17141] CommonType!(dchar, char) returns uint

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Apr 28 12:10:19 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=17141

--- Comment #5 from hsteoh at quickfur.ath.cx ---
Hmph.  Looks like the problem is that the very first thing typeMerge() does is
to do integer promotion on the incoming types. Thus, right from the start,
we've already lost the original character types. The only reason this hasn't
shown up earlier is because when the two types are equal, typeMerge() is not
called. So we're essentially only saved "by accident".

Oddly enough, there is an `if (op != TOKquestion || ...)`, which *seems* to
suggest that the intent of the code is *not* to do integer promotions if ?: is
involved. However, the second clause of the if condition, `t1b.ty != t2b.ty`,
appears to be always true, so the check for ?: would appear to be always
irrelevant.  It would seem that && was intended here rather than ||, but I've
to look more carefully to make sure this isn't going to cause massive code
breakage...

--


More information about the Digitalmars-d-bugs mailing list