aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-21 22:38:46 +0000
committerChris Lattner <sabre@nondot.org>2009-04-21 22:38:46 +0000
commit5c59e2b5215eff79372b9498c3559da9d700588d (patch)
treedd6528e07a22559172ba6aef93c07d16f05a6219
parentaf48fdd35633f53c74e982ba7922ca7b2051c1f5 (diff)
Fix rdar://6814047, a crash on invalid in blocks code I noticed when
working on the previous fix. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69742 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaExpr.cpp2
-rw-r--r--test/Sema/block-misc.c13
2 files changed, 8 insertions, 7 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 57902cc02b..fa857575c5 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -4755,8 +4755,8 @@ void Sema::ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope) {
CurFunctionNeedsScopeChecking = CurBlock->SavedFunctionNeedsScopeChecking;
// Pop off CurBlock, handle nested blocks.
+ PopDeclContext();
CurBlock = CurBlock->PrevBlockInfo;
-
// FIXME: Delete the ParmVarDecl objects as well???
}
diff --git a/test/Sema/block-misc.c b/test/Sema/block-misc.c
index 8775aa752a..bef2662bbc 100644
--- a/test/Sema/block-misc.c
+++ b/test/Sema/block-misc.c
@@ -112,6 +112,13 @@ void test11(int i) {
^{ break; }(); // expected-error {{'break' statement not in loop or switch statement}}
}
+
+void (^test12f)(void);
+void test12() {
+ test12f = ^test12f; // expected-error {{type name requires a specifier or qualifier}} expected-error {{expected expression}}
+}
+
+
// rdar://6808730
void *test13 = ^{
int X = 32;
@@ -131,9 +138,3 @@ void test14() {
};
};
}
-
-void (^test12f)(void);
-void test12() {
- test12f = ^test12f; // expected-error {{type name requires a specifier or qualifier}} expected-error {{expected expression}}
-}
-