summaryrefslogtreecommitdiff
path: root/gcc/cp/search.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/search.c')
-rw-r--r--gcc/cp/search.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index d6521fb6f82..3adf9e0a1ab 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -214,9 +214,12 @@ lookup_base (tree t, tree base, base_access access, base_kind *kind_ptr)
t_binfo = TYPE_BINFO (t);
}
- base = complete_type (TYPE_MAIN_VARIANT (base));
+ base = TYPE_MAIN_VARIANT (base);
- if (t_binfo)
+ /* If BASE is incomplete, it can't be a base of T--and instantiating it
+ might cause an error. */
+ if (t_binfo && CLASS_TYPE_P (base)
+ && (COMPLETE_TYPE_P (base) || TYPE_BEING_DEFINED (base)))
{
struct lookup_base_data_s data;