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++/102033] template function signature incorrectly drops top-level cv-qualifiers causing template specialization failing to match
Date: Fri, 15 Oct 2021 21:00:41 +0000	[thread overview]
Message-ID: <bug-102033-4-VnkZ6JHdzO@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102033-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:79802c5dcc043a515f429bb2bec7573b8537c32a

commit r12-4453-g79802c5dcc043a515f429bb2bec7573b8537c32a
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Sep 28 10:02:04 2021 -0400

    c++: array cv-quals and template specialization [PR101402]

    PRs 101402, 102033, etc. demonstrated that the fix for PR92010 wasn't
    handling all cases of the CWG1001/1322 issue with parameter type qual
    stripping and arrays with templates.  The problem turned out to be in
    determine_specialization, which did an extra substitution without the 92010
    fix and then complained that the result didn't match.

    But just removing that wrong/redundant code meant that we were accepting
    specializations with different numbers of parameters, because the code in
    fn_type_unification that compares types in this case wasn't checking for
    length mismatch.

    After fixing that, I realized that fn_type_unification couldn't tell the
    difference between variadic and non-variadic function types, because the
    args array doesn't include the terminal void we use to indicate
non-variadic
    function type.  So I added it, and made the necessary adjustments.

    Thanks to qingzhe "nick" huang <nickhuang99@hotmail.com> for the patch that
    led me to dig more into this, and the extensive testcases.

            PR c++/51851
            PR c++/101402
            PR c++/102033
            PR c++/102034
            PR c++/102039
            PR c++/102044

    gcc/cp/ChangeLog:

            * pt.c (determine_specialization): Remove redundant code.
            (fn_type_unification): Check for mismatched length.
            (type_unification_real): Ignore terminal void.
            (get_bindings): Don't stop at void_list_node.
            * class.c (resolve_address_of_overloaded_function): Likewise.

    gcc/testsuite/ChangeLog:

            * g++.dg/template/fnspec2.C: New test.
            * g++.dg/template/parm-cv1.C: New test.
            * g++.dg/template/parm-cv2.C: New test.
            * g++.dg/template/parm-cv3.C: New test.

  parent reply	other threads:[~2021-10-15 21:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24  9:25 [Bug c++/102033] New: " nickhuang99 at hotmail dot com
2021-08-24  9:33 ` [Bug c++/102033] " pinskia at gcc dot gnu.org
2021-08-24  9:42 ` pinskia at gcc dot gnu.org
2021-08-24 10:12 ` nickhuang99 at hotmail dot com
2021-08-24 11:28 ` redi at gcc dot gnu.org
2021-08-24 13:39 ` redi at gcc dot gnu.org
2021-08-24 15:29 ` redi at gcc dot gnu.org
2021-10-15 21:00 ` cvs-commit at gcc dot gnu.org [this message]
2021-10-25  9:02 ` nickhuang99 at hotmail dot com
2021-12-09  4:45 ` 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-102033-4-VnkZ6JHdzO@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).