gcc/testsuite/g++.dg/cpp1y/constexpr-incr1.C
raw| 1 | // { dg-do compile { target c++14 } } |
| 2 | #define SA(X) static_assert((X),#X) |
| 3 | |
| 4 | constexpr int f (int i) |
| 5 | { |
| 6 | ++i; |
| 7 | int x = i; |
| 8 | ++x; |
| 9 | return x; |
| 10 | } |
| 11 | |
| 12 | constexpr int* g (int* p) |
| 13 | { |
| 14 | ++p; |
| 15 | return p; |
| 16 | } |
| 17 | |
| 18 | constexpr int i = f(42); |
| 19 | SA(i==44); |
| 20 | |
| 21 | int array[4]; |
| 22 | constexpr int* p = g(array); |
| 23 | SA(p == &array[1]); |