[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / Sema / block-call.c
blob0b96c3bee5e33cb899328bfba607ac33b5cb8c79
1 // RUN: %clang_cc1 -fsyntax-only -Wno-strict-prototypes -verify %s -fblocks
3 int (*FP)();
4 int (^IFP) ();
5 int (^II) (int);
6 int main(void) {
7 int (*FPL) (int) = FP; // C doesn't consider this an error.
9 // For Blocks, the ASTContext::typesAreBlockCompatible() makes sure this is an error.
10 int (^PFR) (int) = IFP; // OK
11 PFR = II; // OK
13 int (^IFP) () = PFR; // OK
16 const int (^CIC) () = IFP; // OK - initializing 'const int (^)()' with an expression of type 'int (^)()'}}
18 const int (^CICC) () = CIC;
21 int * const (^IPCC) () = 0;
23 int * const (^IPCC1) () = IPCC;
25 int * (^IPCC2) () = IPCC; // expected-error {{incompatible block pointer types initializing 'int *(^)()' with an expression of type 'int *const (^)()'}}
27 int (^IPCC3) (const int) = PFR;
29 int (^IPCC4) (int, char (^CArg) (double));
31 int (^IPCC5) (int, char (^CArg) (double)) = IPCC4;
33 int (^IPCC6) (int, char (^CArg) (float)) = IPCC4; // expected-error {{incompatible block pointer types initializing 'int (^)(int, char (^)(float))' with an expression of type 'int (^)(int, char (^)(double))'}}
35 IPCC2 = 0;
36 IPCC1 = 1; // expected-error {{invalid block pointer conversion assigning to 'int *const (^)()' from 'int'}}
37 int (^x)() = 0;
38 int (^y)() = 3; // expected-error {{invalid block pointer conversion initializing 'int (^)()' with an expression of type 'int'}}
39 int a = 1;
40 int (^z)() = a+4; // expected-error {{invalid block pointer conversion initializing 'int (^)()' with an expression of type 'int'}}
43 int blah(void) {
44 int (^IFP) (float);
45 char (^PCP)(double, double, char);
47 IFP(1.0);
48 IFP (1.0, 2.0); // expected-error {{too many arguments to block call}}
50 char ch = PCP(1.0, 2.0, 'a');
51 return PCP(1.0, 2.0); // expected-error {{too few arguments to block}}