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++/94632] [10 Regression] canonical types differ for identical types since r10-7622-g12f55e030ed068d5
Date: Sat, 18 Apr 2020 10:55:58 +0000	[thread overview]
Message-ID: <bug-94632-4-xSWeh2sIbY@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-94632-4@http.gcc.gnu.org/bugzilla/>

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

--- 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:f83adb68ed9cef1fbd4c16447eb4e89676df9f62

commit r10-7787-gf83adb68ed9cef1fbd4c16447eb4e89676df9f62
Author: Patrick Palka <ppalka@redhat.com>
Date:   Sat Apr 18 06:22:21 2020 -0400

    c++: spec_hasher::equal and PARM_DECLs [PR94632]

    In the testcase below, during specialization of c<int>::d, we build two
    identical specializations of the parameter type b<decltype(e)::k> -- one
when
    substituting into c<int>::d's TYPE_ARG_TYPES and another when substituting
into
    c<int>::d's DECL_ARGUMENTS.

    We don't reuse the first specialization the second time around as a
consequence
    of the fix for PR c++/56247 which made PARM_DECLs always compare different
from
    one another during spec_hasher::equal.  As a result, when looking up
existing
    specializations of 'b', spec_hasher::equal considers the template argument
    decltype(e')::k to be different from decltype(e'')::k, where e' and e'' are
the
    result of two calls to tsubst_copy on the PARM_DECL e.

    Since the two specializations are considered different due to the mentioned
fix,
    their TYPE_CANONICAL points to themselves even though they are otherwise
    identical types, and this triggers an ICE in
maybe_rebuild_function_decl_type
    when comparing the TYPE_ARG_TYPES of c<int>::d to its DECL_ARGUMENTS.

    This patch fixes this issue at the spec_hasher::equal level by ignoring the
    'comparing_specializations' flag in cp_tree_equal whenever the
DECL_CONTEXTs of
    the two parameters are identical.  This seems to be a sufficient condition
to be
    able to correctly compare PARM_DECLs structurally.  (This also subsumes the
    CONSTRAINT_VAR_P check since constraint variables all have empty, and
therefore
    identical, DECL_CONTEXTs.)

    gcc/cp/ChangeLog:

            PR c++/94632
            * tree.c (cp_tree_equal) <case PARM_DECL>: Ignore
            comparing_specializations if the parameters' contexts are
identical.

    gcc/testsuite/ChangeLog:

            PR c++/94632
            * g++.dg/template/canon-type-14.C: New test.

  parent reply	other threads:[~2020-04-18 10:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-17  7:41 [Bug c++/94632] New: " marxin at gcc dot gnu.org
2020-04-17  7:41 ` [Bug c++/94632] " marxin at gcc dot gnu.org
2020-04-17 12:27 ` ppalka at gcc dot gnu.org
2020-04-17 13:22 ` ppalka at gcc dot gnu.org
2020-04-18 10:55 ` cvs-commit at gcc dot gnu.org [this message]
2020-04-18 10:57 ` 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-94632-4-xSWeh2sIbY@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).