aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2012-01-10 22:04:49 -0500
committerJason Merrill <jason@gcc.gnu.org>2012-01-10 22:04:49 -0500
commit5313d330b2a6596686c2b5e04431c167ef4544be (patch)
tree135c49bd0c79dc64db5be66b09857cee3867e0f7 /gcc/cp
parent4bedcb19b9871fcff39e031656c377edac343e29 (diff)
downloadgcc-5313d330b2a6596686c2b5e04431c167ef4544be.zip
gcc-5313d330b2a6596686c2b5e04431c167ef4544be.tar.gz
gcc-5313d330b2a6596686c2b5e04431c167ef4544be.tar.bz2
re PR c++/51614 (ICE with ambiguous base class)
PR c++/51614 * class.c (build_base_path): Diagnose ambiguous base. From-SVN: r183088
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/class.c19
2 files changed, 20 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 4de8ba1..9b080fb 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
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.
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 79686a2..58c89d3 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -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. */