1 // RUN: %clang_cc1 -x objective-c++ -std=c++11 -fobjc-arc -fblocks -Wimplicit-retain-self -verify %s
3 typedef void (^BlockTy)();
5 void noescapeFunc(__attribute__((noescape)) BlockTy);
6 void escapeFunc(BlockTy);
19 _bar = 3; // expected-warning {{block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior}}
27 (void)_bar; // expected-warning {{block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior}}
29 (void)_bar; // expected-warning {{block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior}}
31 (void)_bar; // expected-warning {{block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior}}
37 - (void)testLambdaInBlock{
38 noescapeFunc(^{ [&](){ (void)_bar; }(); });
39 escapeFunc(^{ [&](){ (void)_bar; }(); }); // expected-warning {{block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior}}
42 - (BlockTy)testDeclType{
43 return ^{ decltype(_bar) i = 12; (void)i; };