aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/consteval-prop5.C
blob: 3bd1b9d167461e98ba1b2e9226e0b167a5725615 (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
// P2564R3
// { dg-do compile { target c++20 } }

consteval int f (int i) { return i; }

struct S {
  int x = f(42);
};

constexpr S
immediate (auto)
{
  return S{};
}

void
g ()
{
  immediate (0);
}

consteval void
test ()
{
  constexpr S s = immediate(0);
  static_assert(s.x == 42);
}