Fix a bug/missing-feature Ted noticed: the 'unused' warning should not
warn about the last stmt in a stmtexpr, f.e. there should be no warning for:
int maxval_stmt_expr(int x, int y) {
return ({int _a = x, _b = y; _a > _b ? _a : _b; });
}
llvm-svn: 41655
diff --git a/clang/Parse/ParseExpr.cpp b/clang/Parse/ParseExpr.cpp
index 51ad217e..c2b54828 100644
--- a/clang/Parse/ParseExpr.cpp
+++ b/clang/Parse/ParseExpr.cpp
@@ -928,10 +928,9 @@
ExprResult Result(true);
CastTy = 0;
- if (ExprType >= CompoundStmt && Tok.getKind() == tok::l_brace &&
- !getLang().NoExtensions) {
+ if (ExprType >= CompoundStmt && Tok.getKind() == tok::l_brace) {
Diag(Tok, diag::ext_gnu_statement_expr);
- Parser::StmtResult Stmt = ParseCompoundStatement();
+ Parser::StmtResult Stmt = ParseCompoundStatement(true);
ExprType = CompoundStmt;
// If the substmt parsed correctly, build the AST node.