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++/97010] C++20 ADL and function templates that are not visible (P0846R0) fails on call with templated type Date: Wed, 07 Oct 2020 21:25:35 +0000 [thread overview] Message-ID: <bug-97010-4-ZZk06Ve24R@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-97010-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97010 --- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>: https://gcc.gnu.org/g:635072248a426c933c74ef4431e82401249b6218 commit r11-3709-g635072248a426c933c74ef4431e82401249b6218 Author: Marek Polacek <polacek@redhat.com> Date: Thu Sep 10 17:27:43 2020 -0400 c++: Fix P0846 (ADL and function templates) in template [PR97010] To quickly recap, P0846 says that a name is also considered to refer to a template if it is an unqualified-id followed by a < and name lookup finds either one or more functions or finds nothing. In a template, when parsing a function call that has type-dependent arguments, we can't perform ADL right away so we set KOENIG_LOOKUP_P in the call to remember to do it when instantiating the call (tsubst_copy_and_build/CALL_EXPR). When the called function is a function template, we represent the call with a TEMPLATE_ID_EXPR; usually the operand is an OVERLOAD. In the P0846 case though, the operand can be an IDENTIFIER_NODE, when name lookup found nothing when parsing the template name. But we weren't handling this correctly in tsubst_copy_and_build. First we need to pass the FUNCTION_P argument from <case TEMPLATE_ID_EXPR> to <case IDENTIFIER_NODE>, otherwise we give a bogus error. And then in <case CALL_EXPR> we need to perform ADL. The rest of the changes is to give better errors when ADL didn't find anything. gcc/cp/ChangeLog: PR c++/97010 * pt.c (tsubst_copy_and_build) <case TEMPLATE_ID_EXPR>: Call tsubst_copy_and_build explicitly instead of using the RECUR macro. Handle a TEMPLATE_ID_EXPR with an IDENTIFIER_NODE as its operand. <case CALL_EXPR>: Perform ADL for a TEMPLATE_ID_EXPR with an IDENTIFIER_NODE as its operand. gcc/testsuite/ChangeLog: PR c++/97010 * g++.dg/cpp2a/fn-template21.C: New test. * g++.dg/cpp2a/fn-template22.C: New test.
next prev parent reply other threads:[~2020-10-07 21:25 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-09-10 13:45 [Bug c++/97010] New: " kirshamir at gmail dot com 2020-09-10 14:14 ` [Bug c++/97010] " mpolacek at gcc dot gnu.org 2020-09-10 22:16 ` mpolacek at gcc dot gnu.org 2020-10-07 21:25 ` cvs-commit at gcc dot gnu.org [this message] 2020-10-20 13:38 ` cvs-commit at gcc dot gnu.org 2020-10-20 13:39 ` mpolacek at gcc dot gnu.org 2021-08-04 11:47 ` redi at gcc dot gnu.org 2021-08-04 11:48 ` redi 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-97010-4-ZZk06Ve24R@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).