1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -verify -fblocks -Wno-objc-root-class %s 2*f4a2713aSLionel Sambuc// radar 7562285 3*f4a2713aSLionel Sambuc 4*f4a2713aSLionel Sambuctypedef int (^blocktype)(int a, int b); 5*f4a2713aSLionel Sambuc 6*f4a2713aSLionel Sambuc@interface A { 7*f4a2713aSLionel Sambuc A* a; 8*f4a2713aSLionel Sambuc id b; 9*f4a2713aSLionel Sambuc Class c; 10*f4a2713aSLionel Sambuc} 11*f4a2713aSLionel Sambuc- (blocktype)Meth; 12*f4a2713aSLionel Sambuc@end 13*f4a2713aSLionel Sambuc 14*f4a2713aSLionel Sambuc@implementation A 15*f4a2713aSLionel Sambuc- (blocktype)Meth { 16*f4a2713aSLionel Sambuc if (b) 17*f4a2713aSLionel Sambuc return (blocktype)b; 18*f4a2713aSLionel Sambuc else if (a) 19*f4a2713aSLionel Sambuc return (blocktype)a; // expected-error {{C-style cast from 'A *' to 'blocktype' (aka 'int (^)(int, int)') is not allowed}} 20*f4a2713aSLionel Sambuc else 21*f4a2713aSLionel Sambuc return (blocktype)c; 22*f4a2713aSLionel Sambuc} 23*f4a2713aSLionel Sambuc@end 24*f4a2713aSLionel Sambuc 25*f4a2713aSLionel Sambuc@interface B { 26*f4a2713aSLionel Sambuc blocktype a; 27*f4a2713aSLionel Sambuc blocktype b; 28*f4a2713aSLionel Sambuc blocktype c; 29*f4a2713aSLionel Sambuc} 30*f4a2713aSLionel Sambuc- (id)Meth; 31*f4a2713aSLionel Sambuc@end 32*f4a2713aSLionel Sambuc 33*f4a2713aSLionel Sambuc@implementation B 34*f4a2713aSLionel Sambuc- (id)Meth { 35*f4a2713aSLionel Sambuc if (a) 36*f4a2713aSLionel Sambuc return (A*)a; // expected-error {{C-style cast from 'blocktype' (aka 'int (^)(int, int)') to 'A *' is not allowed}} 37*f4a2713aSLionel Sambuc if (b) 38*f4a2713aSLionel Sambuc return (id)b; 39*f4a2713aSLionel Sambuc if (c) 40*f4a2713aSLionel Sambuc return (Class)b; 41*f4a2713aSLionel Sambuc} 42*f4a2713aSLionel Sambuc@end 43