aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2021-11-18 10:05:13 -0500
committerPatrick Palka <ppalka@redhat.com>2021-11-18 10:05:13 -0500
commit90de06a7b3ce6ae8381136e58a2dde91fbbb6eff (patch)
tree8681379a56f7d6cf6cfc28b07f4d6cd631b94939 /gcc/cp/pt.c
parent6fa8e0896c6ec96eddcedb2b92502a7bbb525c03 (diff)
downloadgcc-90de06a7b3ce6ae8381136e58a2dde91fbbb6eff.zip
gcc-90de06a7b3ce6ae8381136e58a2dde91fbbb6eff.tar.gz
gcc-90de06a7b3ce6ae8381136e58a2dde91fbbb6eff.tar.bz2
c++: template-id ADL and partial instantiation [PR99911]
Here when partially instantiating the call get<U>(T{}) with T=N::A (for which earlier unqualified name lookup for 'get' found nothing) the arguments after substitution are no longer dependent but the callee still is, so perform_koenig_lookup postpones ADL. But then we go on to diagnose the unresolved template name anyway, as if ADL was already performed and failed. This patch fixes this by avoiding the error path in question when the template arguments of an unresolved template-id are still dependent, mirroring the dependence check in perform_koenig_lookup. PR c++/99911 gcc/cp/ChangeLog: * pt.c (tsubst_copy_and_build) <case CALL_EXPR>: Don't diagnose name lookup failure if the arguments to an unresolved template name are still dependent. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/fn-template24.C: New test.
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 2e31663..ad51c07 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -20434,7 +20434,9 @@ tsubst_copy_and_build (tree t,
if (function != NULL_TREE
&& (identifier_p (function)
|| (TREE_CODE (function) == TEMPLATE_ID_EXPR
- && identifier_p (TREE_OPERAND (function, 0))))
+ && identifier_p (TREE_OPERAND (function, 0))
+ && !any_dependent_template_arguments_p (TREE_OPERAND
+ (function, 1))))
&& !any_type_dependent_arguments_p (call_args))
{
if (TREE_CODE (function) == TEMPLATE_ID_EXPR)