// Now handle "real" floating types (i.e. float, double, long double).
if (lhs->isRealFloatingType() || rhs->isRealFloatingType()) {
// if we have an integer operand, the result is the real floating type.
- if (rhs->isIntegerType() || rhs->isComplexIntegerType()) {
+ if (rhs->isIntegerType()) {
// convert rhs to the lhs floating point type.
return lhs;
}
- if (lhs->isIntegerType() || lhs->isComplexIntegerType()) {
+ if (rhs->isComplexIntegerType()) {
+ // convert rhs to the complex floating point type.
+ return Context.getComplexType(lhs);
+ }
+ if (lhs->isIntegerType()) {
// convert lhs to the rhs floating point type.
return rhs;
}
+ if (lhs->isComplexIntegerType()) {
+ // convert lhs to the complex floating point type.
+ return Context.getComplexType(rhs);
+ }
// We have two real floating types, float/complex combos were handled above.
// Convert the smaller operand to the bigger result.
int result = Context.getFloatingTypeOrder(lhs, rhs);
--- /dev/null
+// RUN: clang %s -verify -fsyntax-only
+
+float a;
+
+int b[__builtin_classify_type(a + 1i) == 9 ? 1 : -1];
+int c[__builtin_classify_type(1i + a) == 9 ? 1 : -1];
+
+double d;
+__typeof__ (d + 1i) e;
+
+int f[sizeof(e) == 2 * sizeof(double) ? 1 : -1];