aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/nontype-class12.C
blob: 11f8c12f3ffaf63c790adb2feb60ac4aaf7c2070 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// PR c++/88744
// { dg-do compile { target c++2a } }

#define SA(X) static_assert((X),#X)

struct S {
  int a;
  int b;
  constexpr S(int a_, int b_) : a{a_}, b{b_} { }
};

template<S s = {1, 2}>
struct X {
  static constexpr int i = s.a;
  static constexpr int j = s.b;
};
X x; // ok, X<{1, 2}>
X<{3, 4}> x2;

SA (x.i == 1);
SA (x.j == 2);
SA (x2.i == 3);
SA (x2.j == 4);