1 // RUN: %clang_cc1 -fsyntax-only -fobjc-arc -verify -fblocks -triple x86_64-apple-darwin10.0.0 %s 2 // rdar://10187884 3 4 typedef void (^blk)(id, __attribute((ns_consumed)) id); 5 typedef void (^blk1)(__attribute((ns_consumed))id, __attribute((ns_consumed)) id); 6 blk a = ^void (__attribute((ns_consumed)) id, __attribute((ns_consumed)) id){}; // expected-error {{cannot initialize a variable of type '__strong blk'}} 7 8 blk b = ^void (id, __attribute((ns_consumed)) id){}; 9 10 blk c = ^void (__attribute((ns_consumed)) id, __attribute((ns_consumed)) id){}; // expected-error {{cannot initialize a variable of type '__strong blk'}} 11 12 blk d = ^void (id, id) {}; // expected-error {{cannot initialize a variable of type '__strong blk'}} 13 14 blk1 a1 = ^void (__attribute((ns_consumed)) id, id){}; // expected-error {{cannot initialize a variable of type '__strong blk1'}} 15 16 blk1 b2 = ^void (id, __attribute((ns_consumed)) id){}; // expected-error {{cannot initialize a variable of type '__strong blk1'}} 17 18 blk1 c3 = ^void (__attribute((ns_consumed)) id, __attribute((ns_consumed)) id){}; 19 20 blk1 d4 = ^void (id, id) {}; // expected-error {{cannot initialize a variable of type '__strong blk1'}} 21 22 23 typedef void (*releaser_t)(__attribute__((ns_consumed)) id); 24 25 void normalFunction(id); 26 releaser_t r1 = normalFunction; // expected-error {{cannot initialize a variable of type 'releaser_t'}} 27 28 void releaser(__attribute__((ns_consumed)) id); 29 releaser_t r2 = releaser; // no-warning 30 31 template <typename T> 32 void templateFunction(T) {} // expected-note {{candidate function}} 33 releaser_t r3 = templateFunction<id>; // expected-error {{address of overloaded function 'templateFunction' does not match required type 'void (id)'}} 34 35 template <typename T> 36 void templateReleaser(__attribute__((ns_consumed)) T) {} 37 releaser_t r4 = templateReleaser<id>; // no-warning 38 39 40 @class AntiRelease, ExplicitAntiRelease, ProRelease; 41 42 template<> 43 void templateFunction(__attribute__((ns_consumed)) AntiRelease *); // expected-error {{no function template matches function template specialization 'templateFunction'}} 44 45 template<> 46 void templateReleaser(AntiRelease *); // expected-error {{no function template matches function template specialization 'templateReleaser'}} 47 48 template<> 49 void templateReleaser(ExplicitAntiRelease *) {} // expected-error {{no function template matches function template specialization 'templateReleaser'}} 50 51 template<> 52 void templateReleaser(__attribute__((ns_consumed)) ProRelease *); // no-warning 53