1 // { dg-do compile { target c++11 } }
4 constexpr T do_last(T* x, int n) {
8 template<class T, int N>
9 constexpr T last(T (&x)[N]) {
13 constexpr bool is_negative(int x) { return x < 0; }
17 constexpr bool operator()(const T& x) {
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");