* decl.c (make_typename_type): s/parameters/arguments/.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / constexpr-array-ptr5.C
blobeec32d672a26063a706263834203d596caca0c54
1 // { dg-do compile { target c++11 } }
3 template<class T>
4 constexpr T do_last(T* x, int n) {
5  return x[n - 1]; //
8 template<class T, int N>
9 constexpr T last(T (&x)[N]) {
10  return do_last(x, N);
13 constexpr bool is_negative(int x) { return x < 0; }
15 template<class T>
16 struct IsNegative {
17   constexpr bool operator()(const T& x) {
18     return x < T(0);
19   }
22 template<class T, int N, class Pred>
23 constexpr bool has_neg(T (&x)[N], Pred p) {
24   return p(last(x)); // Line 22
27 constexpr int a[] = {1, -2};
29 constexpr auto answer1 = has_neg(a, IsNegative<int>{}); // Line 27
30 constexpr auto answer2 = has_neg(a, is_negative);
32 static_assert(answer2 == answer1, "Error");