1 |
689 |
jeremybenn |
/* String initializers for arrays must not be parenthesized. Bug
|
2 |
|
|
11250 from h.b.furuseth at usit.uio.no. */
|
3 |
|
|
/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
|
4 |
|
|
/* { dg-do compile } */
|
5 |
|
|
/* { dg-options "-std=c99 -pedantic-errors" } */
|
6 |
|
|
|
7 |
|
|
#include <stddef.h>
|
8 |
|
|
|
9 |
|
|
char *a = "a";
|
10 |
|
|
char *b = ("b");
|
11 |
|
|
char *c = (("c"));
|
12 |
|
|
|
13 |
|
|
char d[] = "d";
|
14 |
|
|
char e[] = ("e"); /* { dg-bogus "warning" "warning in place of error" } */
|
15 |
|
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 14 } */
|
16 |
|
|
char f[] = (("f")); /* { dg-bogus "warning" "warning in place of error" } */
|
17 |
|
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 16 } */
|
18 |
|
|
|
19 |
|
|
signed char g[] = { "d" };
|
20 |
|
|
unsigned char h[] = { ("e") }; /* { dg-bogus "warning" "warning in place of error" } */
|
21 |
|
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 20 } */
|
22 |
|
|
signed char i[] = { (("f")) }; /* { dg-bogus "warning" "warning in place of error" } */
|
23 |
|
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 22 } */
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
struct s { char a[10]; int b; wchar_t c[10]; };
|
27 |
|
|
|
28 |
|
|
struct s j = {
|
29 |
|
|
"j",
|
30 |
|
|
1,
|
31 |
|
|
(L"j")
|
32 |
|
|
}; /* { dg-bogus "warning" "warning in place of error" } */
|
33 |
|
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 32 } */
|
34 |
|
|
struct s k = {
|
35 |
|
|
(("k")), /* { dg-bogus "warning" "warning in place of error" } */
|
36 |
|
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 35 } */
|
37 |
|
|
1,
|
38 |
|
|
L"k"
|
39 |
|
|
};
|
40 |
|
|
|
41 |
|
|
struct s l = {
|
42 |
|
|
.c = (L"l"), /* { dg-bogus "warning" "warning in place of error" } */
|
43 |
|
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 42 } */
|
44 |
|
|
.a = "l"
|
45 |
|
|
};
|
46 |
|
|
|
47 |
|
|
struct s m = {
|
48 |
|
|
.c = L"m",
|
49 |
|
|
.a = ("m")
|
50 |
|
|
}; /* { dg-bogus "warning" "warning in place of error" } */
|
51 |
|
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 50 } */
|
52 |
|
|
|
53 |
|
|
char *n = (char []){ "n" };
|
54 |
|
|
|
55 |
|
|
char *o = (char []){ ("o") }; /* { dg-bogus "warning" "warning in place of error" } */
|
56 |
|
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 55 } */
|
57 |
|
|
|
58 |
|
|
wchar_t *p = (wchar_t [5]){ (L"p") }; /* { dg-bogus "warning" "warning in place of error" } */
|
59 |
|
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 58 } */
|