aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/volatile5.C
blob: 291b9bc894acfc38a6374748e1103e913cb0ba87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// PR c++/98947
// { dg-do compile }

volatile int x, y, z;

void
f (bool b)
{
  (b ? x : y) = 1;
  (b ? x : y) += 1; // { dg-bogus "compound assignment" }
  z = (b ? x : y) = 1; // { dg-warning "using value of assignment" "" { target c++20 } }
  ((z = 2) ? x : y) = 1; // { dg-warning "using value of assignment" "" { target c++20 } }
  (b ? (x = 2) : y) = 1; // { dg-warning "using value of assignment" "" { target c++20 } }
  (b ? x : (y = 5)) = 1; // { dg-warning "using value of assignment" "" { target c++20 } }
}