From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- clang/test/Analysis/stack-block-returned.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 clang/test/Analysis/stack-block-returned.cpp (limited to 'clang/test/Analysis/stack-block-returned.cpp') 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}} +} -- cgit v1.2.3