]> gcc.gnu.org Git - gcc.git/commitdiff
search.c (is_subobject_of_p): Handle TEMPLATE_TYPE_PARMs and such as base classes.
authorMark Mitchell <mark@codesourcery.com>
Fri, 23 Apr 1999 10:16:21 +0000 (10:16 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Fri, 23 Apr 1999 10:16:21 +0000 (10:16 +0000)
* search.c (is_subobject_of_p): Handle TEMPLATE_TYPE_PARMs and
such as base classes.

From-SVN: r26601

gcc/cp/ChangeLog
gcc/cp/search.c
gcc/testsuite/g++.old-deja/g++.pt/crash40.C [new file with mode: 0644]

index eeb633eb616b9a2b9dd283ac0d09d0b385540594..20aeda538616014139175162a6c6f2824ea7ed92 100644 (file)
@@ -1,3 +1,8 @@
+1999-04-23  Mark Mitchell  <mark@codesourcery.com>
+
+       * search.c (is_subobject_of_p): Handle TEMPLATE_TYPE_PARMs and
+       such as base classes.
+
 1999-04-22  Brendan Kehoe  <brendan@cygnus.com>
 
        * tree.c (build_exception_variant): Fix typo: use the chain of U,
index 0551474bc69f5747ab2e8a47a20c5ac77678624b..7ce65e63f8edcf4f7c4e7cccbad3b18c0a8eb745 100644 (file)
@@ -1062,21 +1062,27 @@ static int
 is_subobject_of_p (parent, binfo)
      tree parent, binfo;
 {
-  tree binfos = BINFO_BASETYPES (binfo);
-  int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
+  tree binfos;
+  int i, n_baselinks;
 
-  if (TREE_VIA_VIRTUAL (parent))
-    parent = TYPE_BINFO (TREE_TYPE (parent));
-  if (TREE_VIA_VIRTUAL (binfo))
-    binfo = TYPE_BINFO (TREE_TYPE (binfo));
+  parent = canonical_binfo (parent);
+  binfo = canonical_binfo (binfo);
 
   if (parent == binfo)
     return 1;
 
+  binfos = BINFO_BASETYPES (binfo);
+  n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
+
   /* Process and/or queue base types.  */
   for (i = 0; i < n_baselinks; i++)
     {
-      tree base_binfo = canonical_binfo (TREE_VEC_ELT (binfos, i));
+      tree base_binfo = TREE_VEC_ELT (binfos, i);
+      if (!CLASS_TYPE_P (TREE_TYPE (base_binfo)))
+       /* If we see a TEMPLATE_TYPE_PARM, or some such, as a base
+          class there's no way to descend into it.  */
+       continue;
+
       if (is_subobject_of_p (parent, base_binfo))
        return 1;
     }
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash40.C b/gcc/testsuite/g++.old-deja/g++.pt/crash40.C
new file mode 100644 (file)
index 0000000..da828d9
--- /dev/null
@@ -0,0 +1,19 @@
+// Build don't link:
+// Origin: rch@larissa.sd.bi.ruhr-uni-bochum.de
+
+template< class X >
+struct VB: public virtual X
+{};
+
+template< class MOPTerm1, class MOPTerm2 >
+struct MOPTermUnify
+{
+  struct MO:
+    public VB<MOPTerm1>,
+    public VB<MOPTerm2>
+  {
+    void   fix()
+      { 
+      }
+  };
+};
This page took 0.099554 seconds and 5 git commands to generate.