public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51489] New: constexpr not working consistently
@ 2011-12-09 23:41 dave at boostpro dot com
  2011-12-18  7:07 ` [Bug c++/51489] " jason at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: dave at boostpro dot com @ 2011-12-09 23:41 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-12-19  5:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-09 23:41 [Bug c++/51489] New: constexpr not working consistently dave at boostpro dot com
2011-12-18  7:07 ` [Bug c++/51489] " jason at gcc dot gnu.org
2011-12-19  5:59 ` jason at gcc dot gnu.org
2011-12-19  6:01 ` jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).