Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children |
rev | line source |
---|---|
111 | 1 // { dg-do compile { target c++11 } } |
2 | |
3 template<class T> | |
4 constexpr T do_get(T* x, int n) { | |
5 return x[n - 1]; | |
6 } | |
7 | |
8 template<class T, int N> | |
9 constexpr T get(T (&x)[N]) { | |
10 return do_get(x, N); | |
11 } | |
12 | |
13 constexpr int arr_i[] = {1}; | |
14 constexpr auto var = get(arr_i); // #2 | |
15 static_assert(var == arr_i[0], "Error"); |