StmtPrinter: factor out arg printing code to PrintCallArgs
[clang.git] / test / SemaObjCXX / cstyle-block-pointer-cast.mm
blob72f5283dea37734df9fe4272845fb44ad9275be6
1 // RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s
2 // radar 7562285
4 typedef int (^blocktype)(int a, int b);
6 @interface A {
7     A* a;
8     id b;
9     Class c;
11 - (blocktype)Meth;
12 @end
14 @implementation A
15 - (blocktype)Meth {
16         if (b)
17           return (blocktype)b;
18         else if (a)
19           return (blocktype)a; // expected-error {{C-style cast from 'A *' to 'blocktype' (aka 'int (^)(int, int)') is not allowed}}
20         else
21           return (blocktype)c;
23 @end
25 @interface B {
26     blocktype a;
27     blocktype b;
28     blocktype c;
30 - (id)Meth;
31 @end
33 @implementation B
34 - (id)Meth {
35         if (a)
36           return (A*)a; // expected-error {{C-style cast from 'blocktype' (aka 'int (^)(int, int)') to 'A *' is not allowed}}
37         if (b)
38           return (id)b;
39         if (c)
40           return (Class)b;
42 @end