aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaStmt.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-05-15 21:45:53 +0000
committerDouglas Gregor <dgregor@apple.com>2009-05-15 21:45:53 +0000
commit4a2e2041edc63db687677325e113b39b9d123c40 (patch)
tree49fb2aa5b377050c0f3eef363fde77b979f2e088 /lib/Sema/SemaStmt.cpp
parent49f25ecf7ff358039ce4c9254b867f32110e660e (diff)
Template instantiation for WhileStmt and CXXConditionDeclExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71896 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r--lib/Sema/SemaStmt.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index a5277a9293..652e2a6e0f 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -520,17 +520,19 @@ Sema::ActOnWhileStmt(SourceLocation WhileLoc, ExprArg Cond, StmtArg Body) {
Expr *condExpr = Cond.takeAs<Expr>();
assert(condExpr && "ActOnWhileStmt(): missing expression");
- DefaultFunctionArrayConversion(condExpr);
- Cond = condExpr;
- QualType condType = condExpr->getType();
-
- if (getLangOptions().CPlusPlus) {
- if (CheckCXXBooleanCondition(condExpr)) // C++ 6.4p4
- return StmtError();
- } else if (!condType->isScalarType()) // C99 6.8.5p2
- return StmtError(Diag(WhileLoc,
- diag::err_typecheck_statement_requires_scalar)
- << condType << condExpr->getSourceRange());
+ if (!condExpr->isTypeDependent()) {
+ DefaultFunctionArrayConversion(condExpr);
+ Cond = condExpr;
+ QualType condType = condExpr->getType();
+
+ if (getLangOptions().CPlusPlus) {
+ if (CheckCXXBooleanCondition(condExpr)) // C++ 6.4p4
+ return StmtError();
+ } else if (!condType->isScalarType()) // C99 6.8.5p2
+ return StmtError(Diag(WhileLoc,
+ diag::err_typecheck_statement_requires_scalar)
+ << condType << condExpr->getSourceRange());
+ }
Cond.release();
return Owned(new (Context) WhileStmt(condExpr, Body.takeAs<Stmt>(),