diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -1125,6 +1125,11 @@ bool LHSFloat = LHSType->isRealFloatingType(); bool RHSFloat = RHSType->isRealFloatingType(); + // FIXME: Implement floating to fixed point conversion.(Bug 46268) + // Reference N1169 4.1.4 (Type conversion, usual arithmetic conversions). + if ((LHSType->isFixedPointType() && RHSFloat) || + (LHSFloat && RHSType->isFixedPointType())) + return QualType(); // If we have two real floating types, convert the smaller operand // to the bigger result. if (LHSFloat && RHSFloat) { diff --git a/clang/test/Frontend/fixed_point_errors.c b/clang/test/Frontend/fixed_point_errors.c --- a/clang/test/Frontend/fixed_point_errors.c +++ b/clang/test/Frontend/fixed_point_errors.c @@ -286,3 +286,8 @@ // Division by zero short _Accum div_zero = 4.5k / 0.0lr; // expected-error {{initializer element is not a compile-time constant}} + +void foo(void) { + _Accum x = 0.5k; + if (x == 0.5) {} // expected-error{{invalid operands to binary expression ('_Accum' and 'double')}} +}