/* String initializers for arrays must not be parenthesized. Bug
|
/* String initializers for arrays must not be parenthesized. Bug
|
11250 from h.b.furuseth at usit.uio.no. */
|
11250 from h.b.furuseth at usit.uio.no. */
|
/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
|
/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
|
/* { dg-do compile } */
|
/* { dg-do compile } */
|
/* { dg-options "-std=c99 -pedantic-errors" } */
|
/* { dg-options "-std=c99 -pedantic-errors" } */
|
|
|
#include <stddef.h>
|
#include <stddef.h>
|
|
|
char *a = "a";
|
char *a = "a";
|
char *b = ("b");
|
char *b = ("b");
|
char *c = (("c"));
|
char *c = (("c"));
|
|
|
char d[] = "d";
|
char d[] = "d";
|
char e[] = ("e"); /* { dg-bogus "warning" "warning in place of error" } */
|
char e[] = ("e"); /* { dg-bogus "warning" "warning in place of error" } */
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 14 } */
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 14 } */
|
char f[] = (("f")); /* { dg-bogus "warning" "warning in place of error" } */
|
char f[] = (("f")); /* { dg-bogus "warning" "warning in place of error" } */
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 16 } */
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 16 } */
|
|
|
signed char g[] = { "d" };
|
signed char g[] = { "d" };
|
unsigned char h[] = { ("e") }; /* { dg-bogus "warning" "warning in place of error" } */
|
unsigned char h[] = { ("e") }; /* { dg-bogus "warning" "warning in place of error" } */
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 20 } */
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 20 } */
|
signed char i[] = { (("f")) }; /* { dg-bogus "warning" "warning in place of error" } */
|
signed char i[] = { (("f")) }; /* { dg-bogus "warning" "warning in place of error" } */
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 22 } */
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 22 } */
|
|
|
|
|
struct s { char a[10]; int b; wchar_t c[10]; };
|
struct s { char a[10]; int b; wchar_t c[10]; };
|
|
|
struct s j = {
|
struct s j = {
|
"j",
|
"j",
|
1,
|
1,
|
(L"j")
|
(L"j")
|
}; /* { dg-bogus "warning" "warning in place of error" } */
|
}; /* { dg-bogus "warning" "warning in place of error" } */
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 32 } */
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 32 } */
|
struct s k = {
|
struct s k = {
|
(("k")), /* { dg-bogus "warning" "warning in place of error" } */
|
(("k")), /* { dg-bogus "warning" "warning in place of error" } */
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 35 } */
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 35 } */
|
1,
|
1,
|
L"k"
|
L"k"
|
};
|
};
|
|
|
struct s l = {
|
struct s l = {
|
.c = (L"l"), /* { dg-bogus "warning" "warning in place of error" } */
|
.c = (L"l"), /* { dg-bogus "warning" "warning in place of error" } */
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 42 } */
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 42 } */
|
.a = "l"
|
.a = "l"
|
};
|
};
|
|
|
struct s m = {
|
struct s m = {
|
.c = L"m",
|
.c = L"m",
|
.a = ("m")
|
.a = ("m")
|
}; /* { dg-bogus "warning" "warning in place of error" } */
|
}; /* { dg-bogus "warning" "warning in place of error" } */
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 50 } */
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 50 } */
|
|
|
char *n = (char []){ "n" };
|
char *n = (char []){ "n" };
|
|
|
char *o = (char []){ ("o") }; /* { dg-bogus "warning" "warning in place of error" } */
|
char *o = (char []){ ("o") }; /* { dg-bogus "warning" "warning in place of error" } */
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 55 } */
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 55 } */
|
|
|
wchar_t *p = (wchar_t [5]){ (L"p") }; /* { dg-bogus "warning" "warning in place of error" } */
|
wchar_t *p = (wchar_t [5]){ (L"p") }; /* { dg-bogus "warning" "warning in place of error" } */
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 58 } */
|
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 58 } */
|
|
|