PR tree-optimization/83369 - Missing diagnostics during inlining
[official-gcc.git] / gcc / testsuite / gcc.dg / init-string-1.c
blob67bd7961b75c38b0ffb763026157f92e83a2174d
1 /* 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" } */
7 #include <stddef.h>
9 char *a = "a";
10 char *b = ("b");
11 char *c = (("c"));
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 *-*-* } .-1 } */
16 char f[] = (("f")); /* { dg-bogus "warning" "warning in place of error" } */
17 /* { dg-error "parenthesized|near init" "paren array" { target *-*-* } .-1 } */
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 *-*-* } .-1 } */
22 signed char i[] = { (("f")) }; /* { dg-bogus "warning" "warning in place of error" } */
23 /* { dg-error "parenthesized|near init" "paren array" { target *-*-* } .-1 } */
26 struct s { char a[10]; int b; wchar_t c[10]; };
28 struct s j = {
29 "j",
31 (L"j")
32 /* { dg-error "parenthesized|near init" "paren array" { target *-*-* } .-1 } */
33 }; /* { dg-bogus "warning" "warning in place of error" } */
35 struct s k = {
36 (("k")), /* { dg-bogus "warning" "warning in place of error" } */
37 /* { dg-error "parenthesized|near init" "paren array" { target *-*-* } .-1 } */
39 L"k"
42 struct s l = {
43 .c = (L"l"), /* { dg-bogus "warning" "warning in place of error" } */
44 /* { dg-error "parenthesized|near init" "paren array" { target *-*-* } .-1 } */
45 .a = "l"
48 struct s m = {
49 .c = L"m",
50 .a = ("m")
51 /* { dg-error "parenthesized|near init" "paren array" { target *-*-* } .-1 } */
52 }; /* { dg-bogus "warning" "warning in place of error" } */
54 char *n = (char []){ "n" };
56 char *o = (char []){ ("o") }; /* { dg-bogus "warning" "warning in place of error" } */
57 /* { dg-error "parenthesized|near init" "paren array" { target *-*-* } .-1 } */
59 wchar_t *p = (wchar_t [5]){ (L"p") }; /* { dg-bogus "warning" "warning in place of error" } */
60 /* { dg-error "parenthesized|near init" "paren array" { target *-*-* } .-1 } */