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++/101174] [12 Regression] CTAD causes instantiation of invalid class specialization since r12-926
Date: Wed, 23 Jun 2021 21:27:20 +0000	[thread overview]
Message-ID: <bug-101174-4-AHKjYsAGUl@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101174-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 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:7da4eae3dcef6fd5d955eb2c80c453aa52368004

commit r12-1762-g7da4eae3dcef6fd5d955eb2c80c453aa52368004
Author: Patrick Palka <ppalka@redhat.com>
Date:   Wed Jun 23 17:23:39 2021 -0400

    c++: excessive instantiation during CTAD [PR101174]

    We set DECL_CONTEXT on implicitly generated deduction guides so that
    their access is consistent with that of the constructor.  But this
    apparently leads to excessive instantiation in some cases, ultimately
    because instantiation of a deduction guide should be independent of
    instantiation of the resulting class specialization, but setting the
    DECL_CONTEXT of the former to the latter breaks this independence.

    To fix this, this patch makes push_access_scope handle artificial
    deduction guides specifically rather than setting their DECL_CONTEXT
    in build_deduction_guide.  We could alternatively make the class
    befriend the guide via DECL_BEFRIENDING_CLASSES, but that wouldn't
    be a complete fix and would break class-deduction-access3.C below
    since friendship isn't transitive.

            PR c++/101174

    gcc/cp/ChangeLog:

            * pt.c (push_access_scope): For artificial deduction guides,
            set the access scope to that of the constructor.
            (pop_access_scope): Likewise.
            (build_deduction_guide): Don't set DECL_CONTEXT on the guide.

    libstdc++-v3/ChangeLog:

            * testsuite/23_containers/multiset/cons/deduction.cc:
            Uncomment CTAD example that was rejected by this bug.
            * testsuite/23_containers/set/cons/deduction.cc: Likewise.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp1z/class-deduction-access3.C: New test.
            * g++.dg/cpp1z/class-deduction91.C: New test.

  parent reply	other threads:[~2021-06-23 21:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-23  3:41 [Bug c++/101174] New: [12 Regression] CTAD causes instantiation of invalid specialization ppalka at gcc dot gnu.org
2021-06-23  4:21 ` [Bug c++/101174] [12 Regression] CTAD causes instantiation of invalid specialization since r12-926 ppalka at gcc dot gnu.org
2021-06-23 15:03 ` [Bug c++/101174] [12 Regression] CTAD causes instantiation of invalid class " ppalka at gcc dot gnu.org
2021-06-23 21:27 ` cvs-commit at gcc dot gnu.org [this message]
2021-06-23 21:28 ` ppalka 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-101174-4-AHKjYsAGUl@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).