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++/105758] [12/13 Regression] ICE in build_baselink since r12-6897
Date: Tue, 31 May 2022 20:50:27 +0000	[thread overview]
Message-ID: <bug-105758-4-i6QqB1VFE3@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105758-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 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:4f84f12066953186cce4328b7f178d3daa2fe96e

commit r13-871-g4f84f12066953186cce4328b7f178d3daa2fe96e
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue May 31 16:49:08 2022 -0400

    c++: non-dep call with empty TYPE_BINFO [PR105758]

    Here the out-of-line definition of Z<T>::z causes duplicate_decls to
    change z's type from using the primary template type Z<T> (which is also
    the type of the injected class name) to the implicit instantiation Z<T>,
    and this latter type lacks a TYPE_BINFO (although its TYPE_CANONICAL was
    set by a special case in lookup_template_class to point to the former).

    Later, when processing the non-dependent call z->foo(0), build_over_call
    relies on the object argument's TYPE_BINFO to build the templated form
    for this call, which fails because the object argument type has empty
    TYPE_BINFO due to the above.

    It seems weird that the implicit instantiation Z<T> doesn't have the
    same TYPE_BINFO as the primary template type Z<T>, despite them being
    proclaimed equivalent via TYPE_CANONICAL.  So I tried also setting
    TYPE_BINFO in the special case in lookup_template_class, but that led to
    some problems with constrained partial specializations of the form Z<T>.
    I'm not sure what, if anything, we ought to do about the subtle
    differences between these two versions of the same type.

    Fortunately it seems we don't need to rely on TYPE_BINFO at all in
    build_over_call here -- the z_candidate struct already contains the
    exact binfos we need to rebuild the BASELINK for the templated form.

            PR c++/105758

    gcc/cp/ChangeLog:

            * call.cc (build_over_call): Use z_candidate::conversion_path
            and ::access_path instead of TYPE_BINFO when building the
            BASELINK for the templated form.

    gcc/testsuite/ChangeLog:

            * g++.dg/template/non-dependent24.C: New test.

  parent reply	other threads:[~2022-05-31 20:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-28 11:46 [Bug c++/105758] New: " jakub at gcc dot gnu.org
2022-05-28 11:47 ` [Bug c++/105758] " jakub at gcc dot gnu.org
2022-05-31 13:24 ` mpolacek at gcc dot gnu.org
2022-05-31 14:45 ` ppalka at gcc dot gnu.org
2022-05-31 20:50 ` cvs-commit at gcc dot gnu.org [this message]
2022-07-21 16:47 ` [Bug c++/105758] [12 " cvs-commit at gcc dot gnu.org
2022-07-21 16:48 ` 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-105758-4-i6QqB1VFE3@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).