void test1() {
int a[] = {0,1,1,2,3};
int []b = {0,1,4,9,16};
- // expected-error@-1{{brackets go after the identifier}}
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the identifier}}
// CHECK: {{^}} int []b = {0,1,4,9,16};
// CHECK: {{^}} ~~ ^
// CHECK: {{^}} []
struct S {
int [1][1]x;
- // expected-error@-1{{brackets go after the identifier}}
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the identifier}}
// CHECK: {{^}} int [1][1]x;
// CHECK: {{^}} ~~~~~~ ^
// CHECK: {{^}} [1][1]
// CHECK: {{^}} int [5] *;
// CHECK: {{^}} ^
// CHECK-NOT: fix-it
- // expected-error@-5{{brackets go after the identifier}}
+ // expected-error@-5{{brackets are not allowed here; to declare an array, place the brackets after the identifier}}
// CHECK: {{^}} int [5] *;
// CHECK: {{^}} ~~~~ ^
// CHECK: {{^}} ()[5]
// CHECK: fix-it:{{.*}}:{[[@LINE-11]]:12-[[@LINE-11]]:12}:")[5]"
int [5] * a;
- // expected-error@-1{{brackets go after the identifier}}
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the identifier}}
// CHECK: {{^}} int [5] * a;
// CHECK: {{^}} ~~~~ ^
// CHECK: {{^}} ( )[5]
void test1() {
int a[] = {0,1,1,2,3};
int []b = {0,1,4,9,16};
- // expected-error@-1{{brackets go after the unqualified-id}}
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
// CHECK: {{^}} int []b = {0,1,4,9,16};
// CHECK: {{^}} ~~ ^
// CHECK: {{^}} []
int *f = b; // No undeclared identifer error here.
int[1] g[2];
- // expected-error@-1{{brackets go after the unqualified-id}}
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
// CHECK: {{^}} int[1] g[2];
// CHECK: {{^}} ~~~ ^
// CHECK: {{^}} [1]
void test2() {
int [3] (*a) = 0;
- // expected-error@-1{{brackets go after the unqualified-id}}
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
// CHECK: {{^}} int [3] (*a) = 0;
// CHECK: {{^}} ~~~~ ^
// CHECK: {{^}} [3]
struct A {
static int [1][1]x;
- // expected-error@-1{{brackets go after the unqualified-id}}
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
// CHECK: {{^}} static int [1][1]x;
// CHECK: {{^}} ~~~~~~ ^
// CHECK: {{^}} [1][1]
};
int [1][1]A::x = { {42} };
-// expected-error@-1{{brackets go after the unqualified-id}}
+// expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
// CHECK: {{^}}int [1][1]A::x = { {42} };
// CHECK: {{^}} ~~~~~~ ^
// CHECK: {{^}} [1][1]
struct B { static int (*x)[5]; };
int [5] *B::x = 0;
-// expected-error@-1{{brackets go after the unqualified-id}}
+// expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
// CHECK: {{^}}int [5] *B::x = 0;
// CHECK: {{^}} ~~~~ ^
// CHECK: {{^}} ( )[5]
void test3() {
int [3] *a;
- // expected-error@-1{{brackets go after the unqualified-id}}
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
// CHECK: {{^}} int [3] *a;
// CHECK: {{^}} ~~~~ ^
// CHECK: {{^}} ( )[3]
void test4() {
int [2] a;
- // expected-error@-1{{brackets go after the unqualified-id}}
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
// CHECK: {{^}} int [2] a;
// CHECK: {{^}} ~~~~ ^
// CHECK: {{^}} [2]
// CHECK: fix-it:{{.*}}:{[[@LINE-6]]:12-[[@LINE-6]]:12}:"[2]"
int [2] &b = a;
- // expected-error@-1{{brackets go after the unqualified-id}}
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
// CHECK: {{^}} int [2] &b = a;
// CHECK: {{^}} ~~~~ ^
// CHECK: {{^}} ( )[2]
static int arr[3];
};
int [3] ::test6::A::arr = {1,2,3};
-// expected-error@-1{{brackets go after the unqualified-id}}
+// expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
// CHECK: {{^}}int [3] ::test6::A::arr = {1,2,3};
// CHECK: {{^}} ~~~~ ^
// CHECK: {{^}} [3]
class A{};
void test() {
int [3] A::*a;
- // expected-error@-1{{brackets go after the unqualified-id}}
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
// CHECK: {{^}} int [3] A::*a;
// CHECK: {{^}} ~~~~ ^
// CHECK: {{^}} ( )[3]
// CHECK: fix-it:{{.*}}:{[[@LINE-7]]:16-[[@LINE-7]]:16}:")[3]"
}
}
-// CHECK: 14 errors generated.
+
+namespace test8 {
+struct A {
+ static const char f[];
+};
+const char[] A::f = "f";
+// expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
+}
+// CHECK: 15 errors generated.