summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-06-27 22:48:56 +0000
committerChris Lattner <sabre@nondot.org>2008-06-27 22:48:56 +0000
commite6c693d9322c5b4077f9a246535d535693b694b8 (patch)
tree2b870157376c9c10023bd554be17d31b5382410b /clang/lib
parentacbc2d200ded5d9d0fbf09b802bad43b15d886ca (diff)
downloadbcm5719-llvm-e6c693d9322c5b4077f9a246535d535693b694b8.tar.gz
bcm5719-llvm-e6c693d9322c5b4077f9a246535d535693b694b8.zip
Fix a bug where we didn't promote 'const float' (or typedefs) to
double in some places. llvm-svn: 52846
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index e84971062ed..70899190839 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -1045,10 +1045,12 @@ void Sema::DefaultArgumentPromotion(Expr *&Expr) {
QualType Ty = Expr->getType();
assert(!Ty.isNull() && "DefaultArgumentPromotion - missing type");
- if (Ty == Context.FloatTy)
- ImpCastExprToType(Expr, Context.DoubleTy);
- else
- UsualUnaryConversions(Expr);
+ // 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);
}
/// DefaultFunctionArrayConversion (C99 6.3.2.1p3, C99 6.3.2.1p4).
OpenPOWER on IntegriCloud