[PATCH] Fix fallout from r219557

Richard Smith richard at metafoo.co.uk
Tue Nov 11 12:32:05 PST 2014


This change is incorrect. The usual arithmetic conversions do *not* take `(_Complex double, double)` to `(_Complex double, _Complex double)`; note C11 6.13.1.8/1 ("... without change of type domain").

The bug lies in the conditional operator; per 6.5.15/5, "If both the second and third operands have arithmetic type, the result type that would be determined by the usual arithmetic conversions, were they applied to those two operands, is the type of the result." The problem is that `CheckConditionalOperands` discards the result of `UsualArithmeticConversions` (that is, the result type), and instead blindly uses the LHS type. The right place for this fix is there `CheckConditionalOperands` (and in `CXXCheckConditionalOperands`).

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D6217






More information about the cfe-commits mailing list