aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-12-04 06:09:13 +0000
committerJohn McCall <rjmccall@apple.com>2010-12-04 06:09:13 +0000
commitabc56c726178fc7c8a3f45185768426a6e9d584e (patch)
treea6d10000ef20e88638357a3f36e586b031488042 /lib/Sema
parente7c68495633f36cf80be091f7d85c93476f3f2f2 (diff)
When deciding whether to complain about the type of a boolean condition, use
the type of the expression *after* array/function decay. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120895 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r--lib/Sema/SemaExpr.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 8b29667bae..cf17566d41 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -9037,12 +9037,12 @@ bool Sema::CheckBooleanCondition(Expr *&E, SourceLocation Loc) {
return Diag(E->getLocStart(), diag::err_invalid_use_of_bound_member_func)
<< E->getSourceRange();
- QualType T = E->getType();
-
if (getLangOptions().CPlusPlus)
return CheckCXXBooleanCondition(E); // C++ 6.4p4
DefaultFunctionArrayLvalueConversion(E);
+
+ QualType T = E->getType();
if (!T->isScalarType()) // C99 6.8.4.1p1
return Diag(Loc, diag::err_typecheck_statement_requires_scalar)
<< T << E->getSourceRange();