public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/103879] error: accessing value of variant::_Copy_ctor_base through a 'const variant<string>' glvalue in a constant expression
Date: Mon, 10 Jan 2022 19:59:07 +0000	[thread overview]
Message-ID: <bug-103879-4-RBaC8ik1rr@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103879-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:ab36b554bd90e8db279d13b133369118814f13fb

commit r12-6425-gab36b554bd90e8db279d13b133369118814f13fb
Author: Patrick Palka <ppalka@redhat.com>
Date:   Mon Jan 10 14:57:54 2022 -0500

    c++: constexpr base-to-derived conversion with offset 0 [PR103879]

    r12-136 made us canonicalize an object/offset pair with negative offset
    into one with a nonnegative offset, by iteratively absorbing the
    innermost component into the offset and stopping as soon as the offset
    becomes nonnegative.

    This patch strengthens this transformation by making it keep on absorbing
    even if the offset is already 0 as long as the innermost component is at
    position 0 (and thus absorbing doesn't change the offset).  This lets us
    accept the two constexpr testcases below, which we'd previously reject
    essentially because cxx_fold_indirect_ref would be unable to resolve
    *(B*)&b.D123 (where D123 is the base A subobject at position 0) to just b.

            PR c++/103879

    gcc/cp/ChangeLog:

            * constexpr.c (cxx_fold_indirect_ref): Split out object/offset
            canonicalization step into a local lambda.  Strengthen it to
            absorb more components at position 0.  Use it before both calls
            to cxx_fold_indirect_ref_1.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp1y/constexpr-base2.C: New test.
            * g++.dg/cpp1y/constexpr-base2a.C: New test.

  parent reply	other threads:[~2022-01-10 19:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-31 15:33 [Bug libstdc++/103879] New: " hewillk at gmail dot com
2021-12-31 22:10 ` [Bug libstdc++/103879] " pinskia at gcc dot gnu.org
2021-12-31 22:10 ` pinskia at gcc dot gnu.org
2021-12-31 23:44 ` lhlaurini at hotmail dot com
2022-01-01 16:45 ` redi at gcc dot gnu.org
2022-01-04  4:57 ` ppalka at gcc dot gnu.org
2022-01-04 14:13 ` [Bug c++/103879] " ppalka at gcc dot gnu.org
2022-01-05 16:20 ` hewillk at gmail dot com
2022-01-05 16:23 ` redi at gcc dot gnu.org
2022-01-05 18:53 ` ppalka at gcc dot gnu.org
2022-01-06  1:57 ` hewillk at gmail dot com
2022-01-10 19:59 ` cvs-commit at gcc dot gnu.org [this message]
2022-01-10 20:01 ` ppalka at gcc dot gnu.org
2022-10-05 23:20 ` pinskia at gcc dot gnu.org

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-103879-4-RBaC8ik1rr@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).