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++/101247] ICE when using static constexpr bool defined in parent-class in nested class constructor requires-clause
Date: Tue, 13 Jul 2021 14:03:44 +0000	[thread overview]
Message-ID: <bug-101247-4-qSjXoOTj2q@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101247-4@http.gcc.gnu.org/bugzilla/>

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

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

https://gcc.gnu.org/g:6d11dd94e53103641f9826b14e3086399f2a948c

commit r11-8733-g6d11dd94e53103641f9826b14e3086399f2a948c
Author: Patrick Palka <ppalka@redhat.com>
Date:   Fri Jul 9 10:20:22 2021 -0400

    c++: find_template_parameters and TEMPLATE_DECLs [PR101247]

    r12-1989 fixed the testcase in the PR, but unfortunately the fix is
    buggy: it breaks the case where the common template between the
    TEMPLATE_DECL t and ctx_parms is the innermost template (as in
    concepts-memtmpl5.C below).  This can be fixed by instead passing the
    TREE_TYPE of ctmpl to common_enclosing_class when ctmpl is a class
    template.

    But even after that's fixed, the analogous case where the innermost
    template is a partial specialization is still broken (as in
    concepts-memtmpl5a.C below), because ctmpl is always a primary template.

    So this patch instead takes a diferent approach that doesn't rely on
    ctx_parms at all: when looking for the template parameters of a
    TEMPLATE_DECL that are shared with the current template context, just
    walk its DECL_CONTEXT.  As long as the template is not overly general
    (e.g. we didn't pass it through most_general_template), this should give
    us exactly what we want, since if a TEMPLATE_DECL can be referred to
    from some template context then the template parameters it uses must all
    be in-scope and contained in its DECL_CONTEXT.  This effectively makes
    us treat TEMPLATE_DECLs more similarly to other _DECLs (whose DECL_CONTEXT
    we also walk).

            PR c++/101247

    gcc/cp/ChangeLog:

            * pt.c (any_template_parm_r) <case TEMPLATE_DECL>: Just walk the
            DECL_CONTEXT.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/concepts-memtmpl4.C: Uncomment the commented out
            example, which we now handle correctly.
            * g++.dg/cpp2a/concepts-memtmpl5.C: New test.
            * g++.dg/cpp2a/concepts-memtmpl5a.C: New test.

    (cherry picked from commit f53e66019df819f55d424cc56f8b0ea81c074b55)

  parent reply	other threads:[~2021-07-13 14:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-29  1:15 [Bug c++/101247] New: ICE when using static constexpr bool defined in base-class in derived " lewissbaker.opensource at gmail dot com
2021-06-29  8:11 ` [Bug c++/101247] " marxin at gcc dot gnu.org
2021-06-30 18:16 ` [Bug c++/101247] ICE when using static constexpr bool defined in parent-class in nested " ppalka at gcc dot gnu.org
2021-07-02 17:55 ` cvs-commit at gcc dot gnu.org
2021-07-09 14:22 ` cvs-commit at gcc dot gnu.org
2021-07-13 14:03 ` cvs-commit at gcc dot gnu.org
2021-07-13 14:03 ` cvs-commit at gcc dot gnu.org [this message]
2021-07-13 14:09 ` 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-101247-4-qSjXoOTj2q@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).