aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/constinit21.C
blob: 18bca90120243b02167d7d73add33d1c033f1512 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// PR c++/120506
// { dg-do compile { target c++20 } }
// Test that we give more information about why the init is non-constant

struct A
{
  constexpr A(int c) : counter(c) { }

  int counter;
};


struct B : A
{
  constexpr B(int c) : A(c) { }

  int i; // OOPS, not initialized
};

struct C
{
  B sem;

  constexpr C(int c) : sem(c) { }
};

constinit C s(0);		// { dg-error "incompletely initialized" }
// { dg-prune-output "constant" }