2010-08-19 Jason Merrill <jason@redhat.com>
+ * call.c (reference_related_p): Check for error_mark_node.
+ (add_function_candidate): Check it instead of
+ same_type_ignoring_top_level_qualifiers_p.
+
PR c++/45315
* init.c (build_new_1): Don't use build_value_init in a template.
(build_value_init): Make sure we don't.
bool
reference_related_p (tree t1, tree t2)
{
+ if (t1 == error_mark_node || t2 == error_mark_node)
+ return false;
+
t1 = TYPE_MAIN_VARIANT (t1);
t2 = TYPE_MAIN_VARIANT (t2);
/* Kludge: When looking for a function from a subobject while generating
an implicit copy/move constructor/operator=, don't consider anything
- that takes (a reference to) a different type. See c++/44909. */
- else if (flags & LOOKUP_SPECULATIVE)
+ that takes (a reference to) an unrelated type. See c++/44909. */
+ else if ((flags & LOOKUP_SPECULATIVE)
+ || (current_function_decl
+ && DECL_DEFAULTED_FN (current_function_decl)))
{
if (DECL_CONSTRUCTOR_P (fn))
i = 1;
if (i && len == i)
{
parmnode = chain_index (i-1, parmlist);
- if (!(same_type_ignoring_top_level_qualifiers_p
- (non_reference (TREE_VALUE (parmnode)), ctype)))
+ if (!reference_related_p (non_reference (TREE_VALUE (parmnode)),
+ ctype))
viable = 0;
}
}
2010-08-19 Jason Merrill <jason@redhat.com>
+ * g++.dg/init/synth3.C: New.
+
* g++.dg/init/value8.C: New.
* g++.dg/tree-ssa/empty-2.C: New.