pt.c (redeclare_class_template): Merge default template arguments in both directions.
authorMark Mitchell <mark@codesourcery.com>
Fri, 20 Aug 1999 06:11:48 +0000 (06:11 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Fri, 20 Aug 1999 06:11:48 +0000 (06:11 +0000)
* pt.c (redeclare_class_template): Merge default template
arguments in both directions.

* typeck.c (common_type): Undo 1999-08-18 change.  Remove
compiler_error message.

From-SVN: r28774

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

index f595a7c0c3a51e3a3356bc29b518ff39b0a478cc..74395d4ce67c139406e49a59c099eaec5c5ad8e7 100644 (file)
@@ -1,3 +1,11 @@
+1999-08-19  Mark Mitchell  <mark@codesourcery.com>
+
+       * pt.c (redeclare_class_template): Merge default template
+       arguments in both directions.
+
+       * typeck.c (common_type): Undo 1999-08-18 change.  Remove
+       compiler_error message.
+
 1999-08-19  Jason Merrill  <jason@yorick.cygnus.com>
 
        * cp-tree.h: Declare flag_use_repository.
index 5560beb8f12a5c0d2a5b29a21e67f880d4274854..1940cfe0d6f8f22db0568498b5290c52aba940d0 100644 (file)
@@ -2666,6 +2666,10 @@ redeclare_class_template (type, parms)
        /* Update the previous template parameters (which are the ones
           that will really count) with the new default value.  */
        TREE_PURPOSE (TREE_VEC_ELT (tmpl_parms, i)) = parm_default;
+      else if (tmpl_default != NULL_TREE)
+       /* Update the new parameters, too; they'll be used as the
+          parameters for any members.  */
+       TREE_PURPOSE (TREE_VEC_ELT (parms, i)) = tmpl_default;
     }
 }
 
index 716fe19323d0e2e3317f66b9a751bb019d0af13e..8ebeed3fa45df0438c561458ecf32a0d6be7d755 100644 (file)
@@ -698,13 +698,8 @@ common_type (t1, t2)
        tt1 = TYPE_MAIN_VARIANT (tt1);
        tt2 = TYPE_MAIN_VARIANT (tt2);
 
-       if (same_type_p (tt1, tt2))
+       if (tt1 == tt2)
          target = tt1;
-       else if (b1)
-         {
-           compiler_error ("common_type called with uncommon member types");
-           target = tt1;
-         }
        else if (tt1 == void_type_node || tt2 == void_type_node)
          target = void_type_node;
        else if (tt1 == unknown_type_node)
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/decl3.C b/gcc/testsuite/g++.old-deja/g++.pt/decl3.C
new file mode 100644 (file)
index 0000000..bdc2501
--- /dev/null
@@ -0,0 +1,5 @@
+// Build don't link:
+// Origin: Jason Merrill <jason@cygnus.com>
+
+template <class T, class U = int> struct A;
+template <class T = int, class U> struct A { };