| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -Wtrivial-auto-var-init -ftrivial-auto-var-init=zero" } */ |
| 3 |
|
| 4 |
int g(int *, int *); |
| 5 |
int f() |
| 6 |
{ |
| 7 |
switch (0) { |
| 8 |
int x; /* { dg-warning "cannot be initialized with" } */ |
| 9 |
int y; /* { dg-warning "cannot be initialized with" } */ |
| 10 |
default: |
| 11 |
return g(&x, &y); |
| 12 |
} |
| 13 |
} |
| 14 |
|
| 15 |
int g1(int, int); |
| 16 |
int f1() |
| 17 |
{ |
| 18 |
switch (0) { |
| 19 |
int x; /* { dg-warning "cannot be initialized with" } */ |
| 20 |
int y; /* { dg-warning "cannot be initialized with" } */ |
| 21 |
default: |
| 22 |
return g1(x, y); |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
struct S |
| 27 |
{ |
| 28 |
char a; |
| 29 |
int b; |
| 30 |
}; |
| 31 |
int g2(int); |
| 32 |
int f2(int input) |
| 33 |
{ |
| 34 |
switch (0) { |
| 35 |
struct S x; /* { dg-warning "cannot be initialized with" } */ |
| 36 |
struct S y; /* { dg-warning "cannot be initialized with" } */ |
| 37 |
default: |
| 38 |
return g2(input) + x.b + y.b; |
| 39 |
} |
| 40 |
} |