http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51489
Bug #: 51489 Summary: constexpr not working consistently Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: d...@boostpro.com I think this is a bug, and the program should compile. struct array { constexpr array() :x(0) {} constexpr int const* begin() { return &x; } int x; }; constexpr array aa; constexpr auto b = aa.begin(); static_assert(b-b == 0, "compiles just fine"); static_assert(aa.begin()-aa.begin() == 0, "compiler thinks it's not a constant expression");