aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>1999-08-20 06:11:48 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-08-20 06:11:48 +0000
commit7ce74c5e5e401108e8b7667e7cc33318947cde41 (patch)
tree254e30b4c2fc8baa50829dee4b5f3e38c1e77732
parentefe0774e6a86cea1bd68e045eb67ea8c4b90431b (diff)
downloadgcc-7ce74c5e5e401108e8b7667e7cc33318947cde41.zip
gcc-7ce74c5e5e401108e8b7667e7cc33318947cde41.tar.gz
gcc-7ce74c5e5e401108e8b7667e7cc33318947cde41.tar.bz2
pt.c (redeclare_class_template): Merge default template arguments in both directions.
* 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
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/pt.c4
-rw-r--r--gcc/cp/typeck.c7
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/decl3.C5
4 files changed, 18 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f595a7c..74395d4 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 5560beb..1940cfe 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -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;
}
}
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 716fe19..8ebeed3 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -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
index 0000000..bdc2501
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/decl3.C
@@ -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 { };