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++/107461] [12 Regression] ambiguity error for friend with templated constexpr argument Date: Mon, 06 Feb 2023 16:33:23 +0000 [thread overview] Message-ID: <bug-107461-4-LCIMzWQFVD@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-107461-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107461 --- Comment #14 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-12 branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>: https://gcc.gnu.org/g:eda24f6c12b6d3777ff3bf3656187e695a3e8dc2 commit r12-9110-geda24f6c12b6d3777ff3bf3656187e695a3e8dc2 Author: Patrick Palka <ppalka@redhat.com> Date: Sun Feb 5 21:35:33 2023 -0500 c++: equivalence of non-dependent calls [PR107461] After r13-5684-g59e0376f607805 the (pruned) callee of a non-dependent CALL_EXPR is a bare FUNCTION_DECL rather than ADDR_EXPR of FUNCTION_DECL. This innocent change revealed that cp_tree_equal doesn't first check dependence of a CALL_EXPR before treating a FUNCTION_DECL callee as a dependent name, which leads to us incorrectly accepting the first two testcases below and rejecting the third: * In the first testcase, cp_tree_equal incorrectly returns true for the two non-dependent CALL_EXPRs f(0) and f(0) (whose CALL_EXPR_FN are different FUNCTION_DECLs) which causes us to treat #2 as a redeclaration of #1. * Same issue in the second testcase, for f<int*>() and f<char>(). * In the third testcase, cp_tree_equal incorrectly returns true for f<int>() and f<void(*)(int)>() which causes us to conflate the two dependent specializations A<decltype(f<int>()(U()))> and A<decltype(f<void(*)(int)>()(U()))>. This patch fixes this by making called_fns_equal treat two callees as dependent names only if the overall CALL_EXPRs are dependent, via a new convenience function call_expr_dependent_name that is like dependent_name but also checks dependence of the overall CALL_EXPR. PR c++/107461 gcc/cp/ChangeLog: * cp-tree.h (call_expr_dependent_name): Declare. * pt.cc (iterative_hash_template_arg) <case CALL_EXPR>: Use call_expr_dependent_name instead of dependent_name. * tree.cc (call_expr_dependent_name): Define. (called_fns_equal): Adjust to take two CALL_EXPRs instead of CALL_EXPR_FNs thereof. Use call_expr_dependent_name instead of dependent_name. (cp_tree_equal) <case CALL_EXPR>: Adjust call to called_fns_equal. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/overload5.C: New test. * g++.dg/cpp0x/overload5a.C: New test. * g++.dg/cpp0x/overload6.C: New test. (cherry picked from commit 31924665c86d47af6b1f22a74f594f2e1dc0ed2d)
next prev parent reply other threads:[~2023-02-06 16:33 UTC|newest] Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-10-30 8:17 [Bug c++/107461] New: GCC rejects program with ambiguity error jlame646 at gmail dot com 2022-10-30 19:13 ` [Bug c++/107461] " pinskia at gcc dot gnu.org 2022-11-08 14:19 ` [Bug c++/107461] [12/13 Regression] ambiguity error for friend with templated constexpr argument ppalka at gcc dot gnu.org 2023-01-13 11:37 ` rguenth at gcc dot gnu.org 2023-02-03 14:41 ` cvs-commit at gcc dot gnu.org 2023-02-03 15:07 ` [Bug c++/107461] [12 " cvs-commit at gcc dot gnu.org 2023-02-03 15:08 ` ppalka at gcc dot gnu.org 2023-02-04 7:26 ` raj.khem at gmail dot com 2023-02-04 10:37 ` jakub at gcc dot gnu.org 2023-02-04 10:39 ` jakub at gcc dot gnu.org 2023-02-04 10:39 ` [Bug c++/107461] [12/13 " jakub at gcc dot gnu.org 2023-02-04 17:02 ` ppalka at gcc dot gnu.org 2023-02-04 17:04 ` ppalka at gcc dot gnu.org 2023-02-04 17:14 ` jakub at gcc dot gnu.org 2023-02-06 2:35 ` cvs-commit at gcc dot gnu.org 2023-02-06 3:01 ` ppalka at gcc dot gnu.org 2023-02-06 16:33 ` cvs-commit at gcc dot gnu.org [this message] 2023-02-06 16:36 ` [Bug c++/107461] [12 " ppalka at gcc dot gnu.org 2023-03-03 14:12 ` 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-107461-4-LCIMzWQFVD@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: linkBe 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).