| 1 |
// { dg-do compile { target c++11 } } |
| 2 |
|
| 3 |
int |
| 4 |
toto () |
| 5 |
{ |
| 6 |
[[gnu::unused]] good: |
| 7 |
return 0; |
| 8 |
} |
| 9 |
|
| 10 |
int |
| 11 |
foo () |
| 12 |
{ |
| 13 |
[[gnu::unused]] good: |
| 14 |
int i = 0; |
| 15 |
|
| 16 |
// A C++11 attribute at the beginning of the return statement is |
| 17 |
// syntactically correct, appertains to the return statement (not to |
| 18 |
// the label) but is currently ignored by this implementation. |
| 19 |
good_ignored : [[gnu::unused]] // { dg-warning "attributes at the beginning of statement are ignored" } |
| 20 |
return i; |
| 21 |
} |
| 22 |
|
| 23 |
int |
| 24 |
bar () |
| 25 |
{ |
| 26 |
// A GNU attribute after the label appertains to the label. |
| 27 |
good: __attribute__((unused)); |
| 28 |
return 0; |
| 29 |
} |
| 30 |
|
| 31 |
int |
| 32 |
baz () |
| 33 |
{ |
| 34 |
// The c++ attribute after the label appertains to the (empty) |
| 35 |
// statement. |
| 36 |
bad: [[gnu::unused]]; // { dg-warning "attributes at the beginning of statement are ignored" } |
| 37 |
return 0; |
| 38 |
} |
| 39 |
|