summaryrefslogtreecommitdiffstats
path: root/Tests/CompileFeatures/cxx_relaxed_constexpr.cpp
blob: 953148d755ff4eb54713461d88ca770128a919b0 (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

struct X
{
  constexpr X()
    : n(5)
  {
    n *= 2;
  }
  int n;
};

constexpr int g(const int (&is)[4])
{
  X x;
  int r = x.n;
  for (int i = 0; i < 5; ++i)
    r += i;
  for (auto& i : is)
    r += i;
  return r;
}

int someFunc()
{
  constexpr int values[4] = { 4, 5, 6, 7 };
  constexpr int k3 = g(values);
  return k3 - 42;
}