summaryrefslogtreecommitdiffstats
path: root/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-01-09 09:38:14 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-01-09 09:38:14 +0000
commit57dec60f901f9ebc7ad488e9ea00f7886563e180 (patch)
tree54cf40aa52beddfec9359f8b89210f2ebaf7b9ec /lib/Sema/SemaExpr.cpp
parent83d12ae2646c6b9db6df794c9510bb1747c3f780 (diff)
Parse: Don't crash when namespace is in GNU statement expr
Parser::ParseNamespace can get a little confused when it found itself inside a compound statement inside of a non-static data member initializer. Try to determine that the statement expression's scope makes sense before trying to parse it's contents. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225514 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r--lib/Sema/SemaExpr.cpp5
1 files changed, 0 insertions, 5 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 623d18d04e..68bad16ff3 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -10275,11 +10275,6 @@ Sema::ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStmt,
assert(!ExprNeedsCleanups && "cleanups within StmtExpr not correctly bound!");
PopExpressionEvaluationContext();
- bool isFileScope
- = (getCurFunctionOrMethodDecl() == nullptr) && (getCurBlock() == nullptr);
- if (isFileScope)
- return ExprError(Diag(LPLoc, diag::err_stmtexpr_file_scope));
-
// FIXME: there are a variety of strange constraints to enforce here, for
// example, it is not possible to goto into a stmt expression apparently.
// More semantic analysis is needed.