aboutsummaryrefslogtreecommitdiff
path: root/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
commit834a72ac74cf4ff07ba6215545dba3db578f8a07 (patch)
treef960808436ff542480fe7577898626489185d0bf /lib/Sema/SemaStmt.cpp
parente8e4f928e51091c1f9c7f5b4595941e33dc0bfec (diff)
Fix rdar://6095136, various crashes with incomplete enum types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54074 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r--lib/Sema/SemaStmt.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index 1462d3d57c..a4e8946b45 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/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);
}