1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 // RUN: not %clang_cc1 -fixit %t -x c -DFIXIT
4 // RUN: %clang_cc1 -fsyntax-only %t -x c -DFIXIT
5 // RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits -fno-diagnostics-show-line-numbers %s 2>&1 | FileCheck %s -strict-whitespace
9 int []b
= {0,1,4,9,16};
10 // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the identifier}}
11 // CHECK: {{^}} int []b = {0,1,4,9,16};
14 // CHECK: fix-it:{{.*}}:{[[@LINE-5]]:7-[[@LINE-5]]:9}:""
15 // CHECK: fix-it:{{.*}}:{[[@LINE-6]]:10-[[@LINE-6]]:10}:"[]"
18 int d
= b
[0]; // No undeclared identifier error here.
21 int *f
= b
; // No undeclared identifier error here.
26 // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the identifier}}
27 // CHECK: {{^}} int [1][1]x;
28 // CHECK: {{^}} ~~~~~~ ^
29 // CHECK: {{^}} [1][1]
30 // CHECK: fix-it:{{.*}}:{[[@LINE-5]]:7-[[@LINE-5]]:13}:""
31 // CHECK: fix-it:{{.*}}:{[[@LINE-6]]:14-[[@LINE-6]]:14}:"[1][1]"
37 // expected-error@-1{{expected identifier or '('}}
38 // CHECK: {{^}} int [][][];
43 // expected-error@-1{{expected member name or ';' after declaration specifiers}}
44 // CHECK: {{^}} int [];
52 // expected-error@-1{{expected identifier or '('}}
53 // CHECK: {{^}} int [5] *;
56 // expected-error@-5{{brackets are not allowed here; to declare an array, place the brackets after the identifier}}
57 // CHECK: {{^}} int [5] *;
60 // CHECK: fix-it:{{.*}}:{[[@LINE-9]]:7-[[@LINE-9]]:11}:""
61 // CHECK: fix-it:{{.*}}:{[[@LINE-10]]:11-[[@LINE-10]]:11}:"("
62 // CHECK: fix-it:{{.*}}:{[[@LINE-11]]:12-[[@LINE-11]]:12}:")[5]"
65 // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the identifier}}
66 // CHECK: {{^}} int [5] * a;
68 // CHECK: {{^}} ( )[5]
69 // CHECK: fix-it:{{.*}}:{[[@LINE-5]]:7-[[@LINE-5]]:11}:""
70 // CHECK: fix-it:{{.*}}:{[[@LINE-6]]:11-[[@LINE-6]]:11}:"("
71 // CHECK: fix-it:{{.*}}:{[[@LINE-7]]:14-[[@LINE-7]]:14}:")[5]"
73 int *b
[5] = a
; // expected-error{{}} a should not be corrected to type b
75 int (*c
)[5] = a
; // a should be the same type as c
79 // CHECK: 8 errors generated.