aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2020-08-10 09:33:17 -0400
committerGiuliano Belinassi <giuliano.belinassi@usp.br>2020-08-17 15:07:55 -0300
commit53cf2ed28ca11ff19b73ab73065e20c9d3c47861 (patch)
tree0761560870d8ebbcc74d5133034c7e34fed883b0 /gcc/cp
parent044d08438c72773a0a5a6dc5768063661c4795c7 (diff)
downloadgcc-53cf2ed28ca11ff19b73ab73065e20c9d3c47861.zip
gcc-53cf2ed28ca11ff19b73ab73065e20c9d3c47861.tar.gz
gcc-53cf2ed28ca11ff19b73ab73065e20c9d3c47861.tar.bz2
c++: constraints and address of template-id
When resolving the address of a template-id, we need to drop functions whose associated constraints are not satisfied, as per [over.over]. We do so in resolve_address_of_overloaded_function, but not in resolve_overloaded_unification or resolve_nondeduced_context, which seems like an oversight. gcc/cp/ChangeLog: * pt.c (resolve_overloaded_unification): Drop functions with unsatisfied constraints. (resolve_nondeduced_context): Likewise. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-fn5.C: New test. * g++.dg/concepts/fn8.C: Generalize dg-error directive to accept "no matching function ..." diagnostic. * g++.dg/cpp2a/concepts-fn1.C: Likewise. * g++.dg/cpp2a/concepts-ts2.C: Likewise. * g++.dg/cpp2a/concepts-ts3.C: Likewise.
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/pt.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index cff2db4..cb81d8e 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -22122,6 +22122,8 @@ resolve_overloaded_unification (tree tparms,
&& !any_dependent_template_arguments_p (subargs))
{
fn = instantiate_template (fn, subargs, tf_none);
+ if (!constraints_satisfied_p (fn))
+ continue;
if (undeduced_auto_decl (fn))
{
/* Instantiate the function to deduce its return type. */
@@ -22268,7 +22270,8 @@ resolve_nondeduced_context (tree orig_expr, tsubst_flags_t complain)
badfn = fn;
badargs = subargs;
}
- else if (elem && (!goodfn || !decls_match (goodfn, elem)))
+ else if (elem && (!goodfn || !decls_match (goodfn, elem))
+ && constraints_satisfied_p (elem))
{
goodfn = elem;
++good;