summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr.C
blob: 36939e1afe14cc34757d0d4937790936622c93d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// { dg-options -std=c++0x }

template<class T>
constexpr T do_get(T* x, int n) {
  return x[n - 1];
}

template<class T, int N>
constexpr T get(T (&x)[N]) {
  return do_get(x, N);
}

constexpr int arr_i[] = {1};
constexpr auto var = get(arr_i); // #2
static_assert(var == arr_i[0], "Error");