tree.c (cp_tree_equal): Adjust final switch formatting.
authorNathan Sidwell <nathan@codesourcery.com>
Fri, 20 Apr 2001 16:06:06 +0000 (16:06 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Fri, 20 Apr 2001 16:06:06 +0000 (16:06 +0000)
cp:
* tree.c (cp_tree_equal): Adjust final switch formatting. Add
't' case.
testsuite:
* g++.old-deja/g++.pt/typename28.C: New test.

From-SVN: r41462

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

index eaee2bb24a37f612f22da3c1f70a7f6b20c77227..8e86dbd154ed39686065efda37cc2904cf43c052 100644 (file)
@@ -1,3 +1,8 @@
+2001-04-20  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * tree.c (cp_tree_equal): Adjust final switch formatting. Add
+       't' case.
+
 2001-04-20  Nathan Sidwell  <nathan@codesourcery.com>
 
        * class.c (dfs_unshared_virtual_bases): Add ATTRIBUTE_UNUSED.
index 09aa0cde2e37ca76ef1ef6a2069fac90ba2c09a4..43c493ecc2bf2cfa36798c76f2cdf056b71ce916 100644 (file)
@@ -2008,21 +2008,27 @@ cp_tree_equal (t1, t2)
 
   switch (TREE_CODE_CLASS (code1))
     {
-      int i;
     case '1':
     case '2':
     case '<':
     case 'e':
     case 'r':
     case 's':
-      cmp = 1;
-      for (i = 0; i < TREE_CODE_LENGTH (code1); ++i)
-       {
-         cmp = cp_tree_equal (TREE_OPERAND (t1, i), TREE_OPERAND (t2, i));
-         if (cmp <= 0)
-           return cmp;
-       }
-      return cmp;
+      {
+       int i;
+       
+       cmp = 1;
+       for (i = 0; i < TREE_CODE_LENGTH (code1); ++i)
+         {
+           cmp = cp_tree_equal (TREE_OPERAND (t1, i), TREE_OPERAND (t2, i));
+           if (cmp <= 0)
+             return cmp;
+         }
+       return cmp;
+      }
+    
+      case 't':
+       return same_type_p (t1, t2) ? 1 : 0;
     }
 
   return -1;
index 157bbed491c5b3e83f8bd6385fcaf07da107e0fb..f2c3d70e037d20475ff9471b45a9bef0f0003942 100644 (file)
@@ -1,3 +1,7 @@
+2001-04-20  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * g++.old-deja/g++.pt/typename28.C: New test.
+
 2001-04-20  Nathan Sidwell  <nathan@codesourcery.com>
 
        * g++.old-deja/g++.abi/empty2.C: New test.
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/typename28.C b/gcc/testsuite/g++.old-deja/g++.pt/typename28.C
new file mode 100644 (file)
index 0000000..a538c4d
--- /dev/null
@@ -0,0 +1,27 @@
+// Build don't link:
+//
+// Origin: Jens.Maurer@gmx.net
+// Copyright (C) 2001 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 11 Apr 2001 <nathan@codesourcery.com>
+
+// Bug 1844. We can meet types in cp_tree_equal via a template-id-expr.
+
+typedef int *Ptr;
+
+template<class T> struct B
+{
+  typedef typename T::template X<T> type;
+  typedef typename T::template X<Ptr> type2;
+  typedef typename T::template X<int *> type3;
+  
+  void foo (type);
+  void baz (type2);
+  
+};
+
+template<class T> void B<T>::foo (type)
+{
+}
+template<class T> void B<T>::baz (type3)
+{
+}