public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/99456] [11 regression] ABI breakage with some static initialization
Date: Mon, 08 Mar 2021 13:30:23 +0000	[thread overview]
Message-ID: <bug-99456-4-yDEHavWn73@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99456-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99456

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Another thing is that perhaps we should be rejecting reinterpret_cast only in
the
pedantic constant expression evaluation mode, not when we allow extensions and
fold as much as we can.  So something like (incremental):
--- gcc/cp/constexpr.c  2021-03-08 13:08:49.944229227 +0100
+++ gcc/cp/constexpr.c  2021-03-08 14:23:01.263716186 +0100
@@ -6629,11 +6629,9 @@

     case NOP_EXPR:
     case CONVERT_EXPR:
-      if (REINTERPRET_CAST_P (t))
+      if (REINTERPRET_CAST_P (t) && !ctx->quiet)
        {
-         if (!ctx->quiet)
-           error_at (loc,
-                     "%<reinterpret_cast%> is not a constant expression");
+         error_at (loc, "%<reinterpret_cast%> is not a constant expression");
          *non_constant_p = true;
          return t;
        }
@@ -8103,13 +8101,6 @@

     case NOP_EXPR:
     case CONVERT_EXPR:
-      if (REINTERPRET_CAST_P (t))
-       {
-         if (flags & tf_error)
-           error_at (loc, "%<reinterpret_cast%> is not a constant
expression");
-         return false;
-       }
-      /* FALLTHRU */
     case VIEW_CONVERT_EXPR:
       /* -- a reinterpret_cast.  FIXME not implemented, and this rule
         may change to something more specific to type-punning (DR 1312).  */

But that doesn't make these inline vars statically initialized either, really
confused on what's going on.

  parent reply	other threads:[~2021-03-08 13:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-07 20:50 [Bug c++/99456] New: " nathan at gcc dot gnu.org
2021-03-07 20:51 ` [Bug c++/99456] " nathan at gcc dot gnu.org
2021-03-07 20:51 ` nathan at gcc dot gnu.org
2021-03-07 21:01 ` pinskia at gcc dot gnu.org
2021-03-08  9:56 ` rguenth at gcc dot gnu.org
2021-03-08 11:34 ` jakub at gcc dot gnu.org
2021-03-08 12:47 ` nathan at gcc dot gnu.org
2021-03-08 13:21 ` jakub at gcc dot gnu.org
2021-03-08 13:30 ` jakub at gcc dot gnu.org [this message]
2021-03-08 13:32 ` nathan at gcc dot gnu.org
2021-03-08 13:39 ` jakub at gcc dot gnu.org
2021-03-08 14:03 ` jakub at gcc dot gnu.org
2021-03-08 14:21 ` jakub at gcc dot gnu.org
2021-03-08 15:48 ` nathan at gcc dot gnu.org
2021-03-09 10:12 ` jakub at gcc dot gnu.org
2021-03-09 11:05 ` jakub at gcc dot gnu.org
2021-03-19 17:38 ` cvs-commit at gcc dot gnu.org
2021-03-19 17:38 ` jakub at gcc dot gnu.org
2021-03-22  2:09 ` unlvsur at live dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-99456-4-yDEHavWn73@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).