aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/constexpr-union1.C
blob: ac8aa5f669cb8c7cdee9237b8356488818cc3f87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// { dg-do compile { target c++20 } }

union U
{
  int x;
  char y;
};

constexpr bool
baz ()
{
  U u;
  u.x = 3;
  u.y = 7;
  return (u.y == 7);
}

static_assert (baz ());