This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/51489] New: constexpr not working consistently


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");


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]