summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/block-misc.c
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-21 22:26:47 +0000
committerChris Lattner <sabre@nondot.org>2009-04-21 22:26:47 +0000
commit497d7b0c8acd6d55555b11e3d49121da71a5cf1d (patch)
treeb263c9c9ca29afa8c027160842cd235957a089f4 /clang/test/Sema/block-misc.c
parenta868bbd392594290cff15a3d25e8a69fe43a3857 (diff)
downloadbcm5719-llvm-497d7b0c8acd6d55555b11e3d49121da71a5cf1d.tar.gz
bcm5719-llvm-497d7b0c8acd6d55555b11e3d49121da71a5cf1d.zip
fix marking of nested blocks with the "hasBlockDeclRefExprs" to
mark exactly the blocks which have references that are "live through". This fixes a rejects valid: rdar://6808730 - [sema] [blocks] block rejected at global scope llvm-svn: 69738
Diffstat (limited to 'clang/test/Sema/block-misc.c')
-rw-r--r--clang/test/Sema/block-misc.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/test/Sema/block-misc.c b/clang/test/Sema/block-misc.c
index efe021efb85..8775aa752ac 100644
--- a/clang/test/Sema/block-misc.c
+++ b/clang/test/Sema/block-misc.c
@@ -112,6 +112,25 @@ void test11(int i) {
^{ break; }(); // expected-error {{'break' statement not in loop or switch statement}}
}
+// rdar://6808730
+void *test13 = ^{
+ int X = 32;
+
+ void *P = ^{
+ return X+4; // References outer block's "X", so outer block is constant.
+ };
+};
+
+void test14() {
+ int X = 32;
+ static void *P = ^{ // expected-error {{initializer element is not a compile-time constant}}
+
+ void *Q = ^{
+ // References test14's "X": outer block is non constant.
+ return X+4;
+ };
+ };
+}
void (^test12f)(void);
void test12() {
OpenPOWER on IntegriCloud