aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-03-10 04:54:39 +0000
committerDouglas Gregor <dgregor@apple.com>2010-03-10 04:54:39 +0000
commitdd8f569f84a73c0b0e1449475f333d101e6c9401 (patch)
tree0666238fe52963c4f2aa7c0f4051823368870817 /lib
parent3cb0ebd5f76abcb776f7cb4062bd79e3268c0dc4 (diff)
Statement expressions can be used in global- or namespace-scoped blocks
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98135 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaExpr.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 10001c356d..2249579ba4 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -6593,7 +6593,8 @@ Sema::ActOnStmtExpr(SourceLocation LPLoc, StmtArg substmt,
assert(SubStmt && isa<CompoundStmt>(SubStmt) && "Invalid action invocation!");
CompoundStmt *Compound = cast<CompoundStmt>(SubStmt);
- bool isFileScope = getCurFunctionOrMethodDecl() == 0;
+ bool isFileScope
+ = (getCurFunctionOrMethodDecl() == 0) && (getCurBlock() == 0);
if (isFileScope)
return ExprError(Diag(LPLoc, diag::err_stmtexpr_file_scope));