OSDN Git Service

PR c++/51489
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / cpp0x / constexpr-ptrsub.C
1 // PR c++/51489
2 // DR 1313
3 // { dg-options "-std=c++0x" }
4
5 struct array
6 {
7   constexpr array() :x(0) {}
8   constexpr int const* begin() { return &x; }
9   int x;
10 };
11 constexpr array aa;
12 constexpr auto b = aa.begin();
13 static_assert(b-b == 0, "compiles just fine");
14 static_assert(aa.begin()-aa.begin() == 0, "compiler thinks it's not a constant expression");