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