summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/constexpr-array25.C
blob: 9162943249f09ab5c5ddfb72177701a1891eddca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// PR c++/95241
// { dg-do compile { target c++11 } }

struct Fragment
{
  int off;
  constexpr Fragment(int _off) : off(_off) { }
  constexpr Fragment() : Fragment(1) { }
};

struct Field
{
  Fragment fragments[3];
  constexpr Field(int off) : fragments{{off}} { }
};

constexpr Field field{0};

static_assert(field.fragments[0].off == 0
	      && field.fragments[1].off == 1
	      && field.fragments[2].off == 1, "");