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

* [Bug c++/51489] constexpr not working consistently
  2011-12-09 23:41 [Bug c++/51489] New: constexpr not working consistently dave at boostpro dot com
@ 2011-12-18  7:07 ` 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
  2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2011-12-18  7:07 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51489

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011-12-18
                 CC|                            |jason at gcc dot gnu.org
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> 2011-12-18 06:27:49 UTC ---
Specifically, DR 1313 makes this a valid constant-expression.


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

* [Bug c++/51489] constexpr not working consistently
  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
  2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2011-12-19  5:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51489

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-12-19 05:57:58 UTC ---
Author: jason
Date: Mon Dec 19 05:57:52 2011
New Revision: 182470

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182470
Log:
    PR c++/51489
    * semantics.c (cxx_eval_outermost_constant_expr): Check for
    conversion from pointer to integer here.
    (cxx_eval_constant_expression) [NOP_EXPR]: Not here.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-ptrsub.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/semantics.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/51489] constexpr not working consistently
  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
  2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2011-12-19  6:01 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51489

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.7.0

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2011-12-19 05:58:26 UTC ---
Fixed.


^ 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).