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