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