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; });
}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41655 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Parse/ParseExpr.cpp b/Parse/ParseExpr.cpp
index 51ad217..c2b54828 100644
--- a/Parse/ParseExpr.cpp
+++ b/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.