This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/51489] New: constexpr not working consistently
- From: "dave at boostpro dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 09 Dec 2011 23:09:03 +0000
- Subject: [Bug c++/51489] New: constexpr not working consistently
- Auto-submitted: auto-generated
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: unassigned@gcc.gnu.org
ReportedBy: dave@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");