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

union U
{
  int x;
  char y;
};

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

static_assert (baz ());