1 // PR c++/67376 - [5/6 regression] Comparison with pointer to past-the-end
2 // of array fails inside constant expression
3 // { dg-do compile { target c++11 } }
7 constexpr const int* pa[] = {
25 #define Assert(e) static_assert ((e), #e)
28 Assert (!(a == (int*)0));
29 Assert (!(a == nullptr));
32 Assert (a != (int*)0);
33 Assert (a != nullptr);
36 Assert (!((int*)0 == a));
37 Assert (!(nullptr == a));
40 Assert ((int*)0 != a);
41 Assert (nullptr != a);
43 bool constexpr test_eq (unsigned inx)
45 return inx ? pa [inx - 1] == 0 && 0 == pa [inx - 1]
46 && test_eq (inx - 1) : pa [inx] == 0 && 0 == pa [inx];
49 Assert (!test_eq (sizeof pa / sizeof *pa));
51 bool constexpr test_ne (unsigned inx)
53 return inx ? pa [inx - 1] != 0 && 0 != pa [inx - 1]
54 && test_ne (inx - 1) : pa [inx] != 0 && 0 != pa [inx];
57 Assert (test_ne (sizeof pa / sizeof *pa));