Commit 5313d330 by Jason Merrill Committed by Jason Merrill

re PR c++/51614 (ICE with ambiguous base class)

	PR c++/51614
	* class.c (build_base_path): Diagnose ambiguous base.

From-SVN: r183088
parent 4bedcb19
2012-01-10 Jason Merrill <jason@redhat.com>
PR c++/51614
* class.c (build_base_path): Diagnose ambiguous base.
PR c++/51433
* semantics.c (cxx_eval_call_expression): Always retry previously
non-constant expressions.
......
......@@ -266,10 +266,25 @@ build_base_path (enum tree_code code,
if (want_pointer)
probe = TYPE_MAIN_VARIANT (TREE_TYPE (probe));
if (code == PLUS_EXPR
&& !SAME_BINFO_TYPE_P (BINFO_TYPE (d_binfo), probe))
{
/* This can happen when adjust_result_of_qualified_name_lookup can't
find a unique base binfo in a call to a member function. We
couldn't give the diagnostic then since we might have been calling
a static member function, so we do it now. */
if (complain & tf_error)
{
tree base = lookup_base (probe, BINFO_TYPE (d_binfo),
ba_unique, NULL);
gcc_assert (base == error_mark_node);
}
return error_mark_node;
}
gcc_assert ((code == MINUS_EXPR
&& SAME_BINFO_TYPE_P (BINFO_TYPE (binfo), probe))
|| (code == PLUS_EXPR
&& SAME_BINFO_TYPE_P (BINFO_TYPE (d_binfo), probe)));
|| code == PLUS_EXPR);
if (binfo == d_binfo)
/* Nothing to do. */
......
2012-01-10 Jason Merrill <jason@redhat.com>
PR c++/51614
* g++.dg/inherit/ambig1.C: New.
PR c++/51433
* g++.dg/cpp0x/constexpr-cache1.C: New.
......
// PR c++/51614
struct A
{
void foo();
};
struct B : A {};
struct C : A {};
struct D : B, C
{
D() { A::foo(); } // { 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