summaryrefslogtreecommitdiff
path: root/clang/test/Analysis/stack-block-returned.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Analysis/stack-block-returned.cpp')
-rw-r--r--clang/test/Analysis/stack-block-returned.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/test/Analysis/stack-block-returned.cpp b/clang/test/Analysis/stack-block-returned.cpp
new file mode 100644
index 0000000..af2cec7
--- /dev/null
+++ b/clang/test/Analysis/stack-block-returned.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -fblocks -verify %s
+
+typedef void (^bptr)(void);
+
+bptr bf(int j) {
+ __block int i;
+ const bptr &qq = ^{ i=0; }; // expected-note {{binding reference variable 'qq' here}}
+ return qq; // expected-error {{returning block that lives on the local stack}}
+}