summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaStmt.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-07-25 23:18:17 +0000
committerChris Lattner <sabre@nondot.org>2008-07-25 23:18:17 +0000
commit903eb518e6d3ff02102e6f7e054558162d51e382 (patch)
tree29904873d25d7333f915a2f760c41c21bd0c86d9 /clang/lib/Sema/SemaStmt.cpp
parent6bf59d82c823d8f00c3a195306d040c1856de1cb (diff)
downloadbcm5719-llvm-903eb518e6d3ff02102e6f7e054558162d51e382.tar.gz
bcm5719-llvm-903eb518e6d3ff02102e6f7e054558162d51e382.zip
Fix rdar://6095136, various crashes with incomplete enum types.
llvm-svn: 54074
Diffstat (limited to 'clang/lib/Sema/SemaStmt.cpp')
-rw-r--r--clang/lib/Sema/SemaStmt.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index 1462d3d57c2..a4e8946b452 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -25,6 +25,12 @@ using namespace clang;
Sema::StmtResult Sema::ActOnExprStmt(ExprTy *expr) {
Expr *E = static_cast<Expr*>(expr);
assert(E && "ActOnExprStmt(): missing expression");
+
+ // C99 6.8.3p2: The expression in an expression statement is evaluated as a
+ // void expression for its side effects. Conversion to void allows any
+ // operand, even incomplete types.
+
+ // Same thing in for stmt first clause (when expr) and third clause.
return E;
}
@@ -536,7 +542,7 @@ Sema::ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc,
if (!SecondType->isScalarType()) // C99 6.8.5p2
return Diag(ForLoc, diag::err_typecheck_statement_requires_scalar,
- SecondType.getAsString(), Second->getSourceRange());
+ SecondType.getAsString(), Second->getSourceRange());
}
return new ForStmt(First, Second, Third, Body, ForLoc);
}
OpenPOWER on IntegriCloud