Commit 3ea1e328 by Paolo Carlini

re PR c++/57948 (internal compiler error: in initialize_reference, at cp/call.c:9285)

/cp
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.

/testsuite
2013-07-29  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/57948
	* g++.dg/conversion/ambig2.C: New.

From-SVN: r201318
parent 88e594b6
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> 2013-07-29 Jason Merrill <jason@redhat.com>
* mangle.c (write_name): Check for null context. * mangle.c (write_name): Check for null context.
......
...@@ -9282,10 +9282,14 @@ initialize_reference (tree type, tree expr, ...@@ -9282,10 +9282,14 @@ initialize_reference (tree type, tree expr,
return error_mark_node; return error_mark_node;
} }
gcc_assert (conv->kind == ck_ref_bind); if (conv->kind == ck_ref_bind)
/* Perform the conversion. */
/* Perform the conversion. */ expr = convert_like (conv, expr, complain);
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. */ /* Free all the conversions we allocated. */
obstack_free (&conversion_obstack, p); 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> 2013-07-29 Maciej W. Rozycki <macro@codesourcery.com>
* gcc.target/mips/fabs-2008.c: New test case. * gcc.target/mips/fabs-2008.c: New test case.
...@@ -85,7 +90,7 @@ ...@@ -85,7 +90,7 @@
* gcc.c-torture/execute/builtins/stpcpy-chk.x: Likewise. * gcc.c-torture/execute/builtins/stpcpy-chk.x: Likewise.
* gcc.dg/pr27095.c: For Epiphany, add -mshort-calls. * 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/torture/pr37868.c: Disable for epiphany.
* gcc.dg/sibcall-6.c: Enable for epiphany. * gcc.dg/sibcall-6.c: Enable for epiphany.
......
// 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" }
}
};
};
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment