@@ -5799,10 +5799,15 @@ mark_used (tree decl, tsubst_flags_t complain)
actually used until after overload resolution. */
if (BASELINK_P (decl))
{
- decl = BASELINK_FUNCTIONS (decl);
- if (really_overloaded_fn (decl))
+ tree fns = BASELINK_FUNCTIONS (decl);
+ if (really_overloaded_fn (fns))
return true;
- decl = OVL_FIRST (decl);
+ fns = OVL_FIRST (fns);
+ if (!mark_used (fns, complain))
+ return false;
+ /* We might have deduced its return type. */
+ TREE_TYPE (decl) = TREE_TYPE (fns);
+ return true;
}
if (!DECL_P (decl))
@@ -22643,6 +22643,10 @@ 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)
new file mode 100644
@@ -0,0 +1,14 @@
+// PR c++/105623
+// { dg-do compile { target c++14 } }
+
+template <class T>
+auto g(T fn) { }
+
+template<typename>
+struct base {
+ static auto value() { }
+};
+
+struct S : base<void> {
+ static void f() { g(value); }
+};