+2013-07-29 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/57948
+ * call.c (initialize_reference): Don't crash when reference_binding
+ returns a conv with conv->kind == ck_ambig.
+
2013-07-29 Jason Merrill <jason@redhat.com>
* mangle.c (write_name): Check for null context.
return error_mark_node;
}
- gcc_assert (conv->kind == ck_ref_bind);
-
- /* Perform the conversion. */
- expr = convert_like (conv, expr, complain);
+ if (conv->kind == ck_ref_bind)
+ /* Perform the conversion. */
+ expr = convert_like (conv, expr, complain);
+ else if (conv->kind == ck_ambig)
+ /* We gave an error in build_user_type_conversion_1. */
+ expr = error_mark_node;
+ else
+ gcc_unreachable ();
/* Free all the conversions we allocated. */
obstack_free (&conversion_obstack, p);
+2013-07-29 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/57948
+ * g++.dg/conversion/ambig2.C: New.
+
2013-07-29 Maciej W. Rozycki <macro@codesourcery.com>
* gcc.target/mips/fabs-2008.c: New test case.
* gcc.c-torture/execute/builtins/stpcpy-chk.x: Likewise.
* gcc.dg/pr27095.c: For Epiphany, add -mshort-calls.
- * gcc.dg/tree-ssa/loop-1.c: Likewise.
+ * gcc.dg/tree-ssa/loop-1.c: Likewise.
* gcc.dg/torture/pr37868.c: Disable for epiphany.
* gcc.dg/sibcall-6.c: Enable for epiphany.
--- /dev/null
+// PR c++/57948
+
+struct Base { };
+struct Derived : Base
+{
+ struct Derived2 : Base
+ {
+ struct ConvertibleToBothDerivedRef
+ {
+ operator Derived&();
+ operator Derived2&();
+ void bind_lvalue_to_conv_lvalue_ambig(ConvertibleToBothDerivedRef both)
+ {
+ Base &br1 = both; // { dg-error "ambiguous" }
+ }
+ };
+ };
+};