PR middle-end/27945
[official-gcc.git] / gcc / testsuite / gcc.dg / nested-func-2.c
blob14f14c67e85045114fa16adf00e65fa0560ac7f0
1 /* PR middle-end/18820 */
2 /* Check that we reject nested functions as initializers
3 of static variables. */
5 /* { dg-do compile } */
6 /* { dg-options "" } */
8 struct S {
9 void (*f)(int);
12 extern void baz(struct S *);
13 extern void p(int);
15 void foo(void)
17 int u;
19 void bar(int val)
21 u = val;
24 static struct S s = { bar }; /* { dg-error "(is not constant)|(near initialization)" } */
26 baz(&s);
27 p(u);