summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
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
commit6cf3f3c75efdf24456ee084e4b8d55ecbd3809d0 (patch)
tree55bea87bd018db62c3a245a3602463e9a1d3aa00 /clang/lib/Sema/SemaExpr.cpp
parente78aac41debf968be07fb755ba94b6fed29167b5 (diff)
downloadbcm5719-llvm-6cf3f3c75efdf24456ee084e4b8d55ecbd3809d0.tar.gz
bcm5719-llvm-6cf3f3c75efdf24456ee084e4b8d55ecbd3809d0.zip
Statement expressions can be used in global- or namespace-scoped blocks
llvm-svn: 98135
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 10001c356d1..2249579ba4e 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/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));
OpenPOWER on IntegriCloud