2003-09-17 Mark Mitchell <mark@codesourcery.com>
+ PR c++/12266
+ * cp-tree.h (tsubst_flags_t): Add tf_conv.
+ * class.c (standard_conversion): Pass tf_conv to
+ instantiate_type.
+ (resolve_address_of_overloaded_function): Do not call mark_used
+ when just checking conversions.
+
PR debug/12066
* cp-lang.c (LANG_HOOKS_BUILTIN_TYPE_DECLS): Define.
* cp-tree.h (cxx_builtin_type_decls): Declare.
if ((TYPE_PTRFN_P (to) || TYPE_PTRMEMFUNC_P (to))
&& expr && type_unknown_p (expr))
{
- expr = instantiate_type (to, expr, tf_none);
+ expr = instantiate_type (to, expr, tf_conv);
if (expr == error_mark_node)
return NULL_TREE;
from = TREE_TYPE (expr);
explained = 1;
}
}
- mark_used (fn);
+
+ /* If we're doing overload resolution purely for the purpose of
+ determining conversion sequences, we should not consider the
+ function used. If this conversion sequence is selected, the
+ function will be marked as used at this point. */
+ if (!(flags & tf_conv))
+ mark_used (fn);
if (TYPE_PTRFN_P (target_type) || TYPE_PTRMEMFUNC_P (target_type))
return build_unary_op (ADDR_EXPR, fn, 0);
(lookup_template_class use) */
tf_stmt_expr_cmpd = 1 << 6, /* tsubsting the compound statement of
a statement expr. */
- tf_stmt_expr_body = 1 << 7 /* tsubsting the statements in the
+ tf_stmt_expr_body = 1 << 7, /* tsubsting the statements in the
body of the compound statement of a
statement expr. */
+ tf_conv = 1 << 8 /* We are determining what kind of
+ conversion might be permissible,
+ not actually performing the
+ conversion. */
} tsubst_flags_t;
/* The kind of checking we can do looking in a class hierarchy. */
+2003-09-17 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/12266
+ * g++.dg/overload/template1.C: New test.
+
2003-09-17 Eric Botcazou <ebotcazou@libertysurf.fr>
* g++.dg/opt/cfg3.C: New test.
--- /dev/null
+template<typename T> T Foo (int) {T d;}
+
+void Baz (void (*)(int), int);
+
+int Foo ();
+int Baz (int (*)(), float);
+
+void Bar ()
+{
+ Baz (Foo, 1.0f);
+
+}