| 1 |
// PR c++/98947 |
| 2 |
// { dg-do compile } |
| 3 |
|
| 4 |
volatile int x, y, z; |
| 5 |
|
| 6 |
void |
| 7 |
f (bool b) |
| 8 |
{ |
| 9 |
(b ? x : y) = 1; |
| 10 |
(b ? x : y) += 1; // { dg-bogus "compound assignment" } |
| 11 |
z = (b ? x : y) = 1; // { dg-warning "using value of assignment" "" { target c++20 } } |
| 12 |
((z = 2) ? x : y) = 1; // { dg-warning "using value of assignment" "" { target c++20 } } |
| 13 |
(b ? (x = 2) : y) = 1; // { dg-warning "using value of assignment" "" { target c++20 } } |
| 14 |
(b ? x : (y = 5)) = 1; // { dg-warning "using value of assignment" "" { target c++20 } } |
| 15 |
} |