diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc index 85fe9b5ab85ffcfc0a033e211f636a0db1f6c8ab..4710c3777c55999f4e8d737ab57244f31abc5081 100644 --- a/gcc/cp/call.cc +++ b/gcc/cp/call.cc @@ -4672,6 +4672,11 @@ resolve_args (vec<tree, va_gc> *args, tsubst_flags_t complain) } else if (invalid_nonstatic_memfn_p (EXPR_LOCATION (arg), arg, complain)) return NULL; + + /* Force auto deduction now. Omit tf_warning to avoid redundant + deprecated warning on deprecated-14.C. */ + if (!mark_single_function (arg, tf_error)) + return NULL; } return args; } diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 4f0ace2644b5b37a2c8d17977f91c81cedae50f2..6de8e496859acd92d92b02141f974f743d7b7303 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -22624,10 +22624,6 @@ unify_one_argument (tree tparms, tree targs, tree parm, tree arg, return unify_success (explain_p); } - /* Force auto deduction now. Use tf_none to avoid redundant - deprecated warning on deprecated-14.C. */ - mark_single_function (arg, tf_none); - arg_expr = arg; arg = unlowered_expr_type (arg); if (arg == error_mark_node) diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn63.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn63.C new file mode 100644 index 0000000000000000000000000000000000000000..ca3bc854065ca4ed604b232c546bf7b849ed402d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn63.C @@ -0,0 +1,12 @@ +// PR c++/105779 +// { dg-do compile { target c++14 } } + +template<int> +struct struct1 +{ + static auto apply() { return 1; } +}; + +int method(int(*f)()); + +int t = method(struct1<1>::apply);