summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1y/constexpr-incr1.C
blob: ecd7c047c851c43d0d260163808d5f8f54ed9e8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// { dg-do compile { target c++14 } }
#define SA(X) static_assert((X),#X)

constexpr int f (int i)
{
  ++i;
  int x = i;
  ++x;
  return x;
}

constexpr int* g (int* p)
{
  ++p;
  return p;
}

constexpr int i = f(42);
SA(i==44);

int array[4];
constexpr int* p = g(array);
SA(p == &array[1]);