xref: /llvm-project/clang/test/Analysis/stack-block-returned.cpp (revision 4a90bf8c3f47e7e6bb08118a1dba6a78f23f92ca)
1 // RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -fblocks -verify %s
2 
3 typedef void (^bptr)(void);
4 
5 bptr bf(int j) {
6   __block int i;
7   const bptr &qq = ^{ i=0; }; // expected-note {{binding reference variable 'qq' here}}
8   return qq; // expected-error {{returning block that lives on the local stack}}
9 }
10