| 1 |
/* PR c++/44062 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-Wunused" } */ |
| 4 |
|
| 5 |
void |
| 6 |
foo (void) |
| 7 |
{ |
| 8 |
int a, b, c, d, e, f, g; |
| 9 |
a = 1; |
| 10 |
b = 2; |
| 11 |
c = 3; |
| 12 |
d = 4; |
| 13 |
e = 5; |
| 14 |
f = 6; |
| 15 |
g = 7; |
| 16 |
a; /* { dg-warning "no effect" } */ |
| 17 |
b, 1; /* { dg-warning "no effect" } */ |
| 18 |
(void) c; |
| 19 |
(void) d, 1; /* { dg-warning "no effect" } */ |
| 20 |
e, f, 1; /* { dg-warning "no effect" } */ |
| 21 |
(void) g, f, 1; /* { dg-warning "no effect" } */ |
| 22 |
} |
| 23 |
|
| 24 |
void |
| 25 |
bar (void) |
| 26 |
{ |
| 27 |
int a; |
| 28 |
int b; |
| 29 |
int c; /* { dg-warning "set but not used" } */ |
| 30 |
a = 1; |
| 31 |
b = 2; |
| 32 |
c = 3; |
| 33 |
c = ({ a++, b; }); |
| 34 |
} |
| 35 |
|
| 36 |
void |
| 37 |
baz (void) |
| 38 |
{ |
| 39 |
int a; |
| 40 |
int b; |
| 41 |
int c; |
| 42 |
int d; |
| 43 |
a = 1; |
| 44 |
b = 2; |
| 45 |
c = 3; |
| 46 |
d = 4; |
| 47 |
d, ( a++, b ), c; /* { dg-warning "no effect" } */ |
| 48 |
} |