]> gcc.gnu.org Git - gcc.git/blame - gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr2.C
PR c++/92590 - wrong handling of inherited default ctor.
[gcc.git] / gcc / testsuite / g++.dg / cpp0x / constexpr-array-ptr2.C
CommitLineData
4b2e63de 1// { dg-do compile { target c++11 } }
fa2200cb
JM
2
3template<class T>
4struct IsNegative {
5 int dummy; // Workaround for empty class problem
6 constexpr IsNegative() : dummy(0) {}
7 constexpr bool operator()(const T& x) {
8 return x < T(0);
9 }
10};
11
12template<class T, int N, class Pred>
13constexpr bool has_neg(T (&x)[N], Pred p) {
14 return p(x[0]) || p(x[1]);
15}
16
17constexpr int a[] = {1, -2};
18
19constexpr auto answer = has_neg(a, IsNegative<int>{}); // #1
20
21static_assert(answer, "Error");
This page took 6.096874 seconds and 5 git commands to generate.