brintos

brintos / llvm-project-archived public Read only

0
0
Text · 805 B · a9b16c6 Raw
42 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify -fblocks -Wno-objc-root-class %s2 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@end12 13@implementation A14- (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        else20          return (blocktype)c;21}22@end23 24@interface B {25    blocktype a;26    blocktype b;27    blocktype c;28}29- (id)Meth;30@end31 32@implementation B33- (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@end42