aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-bitfield2.C
blob: 5b667208ed1bbb7aefff50f2c36c2e96fc95f5e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// PR c++/49136
// { dg-do compile { target c++11 } }

struct day
{
  unsigned d : 5;
  unsigned n : 3;
  constexpr explicit day (int dd) : d(dd), n(7) {}
};

struct date {
  int d;
  constexpr date (day dd) : d(dd.n != 7 ? 7 : dd.d) {}
};

constexpr day d(0);
constexpr date dt(d);
static_assert (dt.d == 0, "Error");