Fix a bug where we didn't promote 'const float' (or typedefs) to
double in some places. llvm-svn: 52846
This commit is contained in:
parent
acbc2d200d
commit
e6c693d932
|
@ -1045,9 +1045,11 @@ void Sema::DefaultArgumentPromotion(Expr *&Expr) {
|
|||
QualType Ty = Expr->getType();
|
||||
assert(!Ty.isNull() && "DefaultArgumentPromotion - missing type");
|
||||
|
||||
if (Ty == Context.FloatTy)
|
||||
ImpCastExprToType(Expr, Context.DoubleTy);
|
||||
else
|
||||
// If this is a 'float' (CVR qualified or typedef) promote to double.
|
||||
if (const BuiltinType *BT = Ty->getAsBuiltinType())
|
||||
if (BT->getKind() == BuiltinType::Float)
|
||||
return ImpCastExprToType(Expr, Context.DoubleTy);
|
||||
|
||||
UsualUnaryConversions(Expr);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: clang %s -emit-llvm
|
||||
// RUN: clang %s -emit-llvm -o -
|
||||
|
||||
// PR1895
|
||||
// sizeof function
|
||||
|
@ -34,3 +34,8 @@ void test4() {
|
|||
t2 = __alignof__(test4());
|
||||
}
|
||||
|
||||
// 'const float' promotes to double in varargs.
|
||||
int test5(const float x, float float_number) {
|
||||
return __builtin_isless(x, float_number);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue