aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@markmitchell.com>1999-01-13 16:27:23 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-01-13 16:27:23 +0000
commit5db698f69596792710fcaed354fec8e1b3cd6937 (patch)
treece6703680015d590b1e0ead271681375f49331bd
parent39268973a6bade5db1cc14e6034c96f0584292c9 (diff)
downloadgcc-5db698f69596792710fcaed354fec8e1b3cd6937.zip
gcc-5db698f69596792710fcaed354fec8e1b3cd6937.tar.gz
gcc-5db698f69596792710fcaed354fec8e1b3cd6937.tar.bz2
decl.c (grokdeclarator): Undo 1998-12-14 change.
* decl.c (grokdeclarator): Undo 1998-12-14 change. * tree.c (build_cplus_array_type_1): Likewise. * pt.c (instantiate_class_template): Remove misleading comment. (tsubst_aggr_type): Substitute if there are template parameters, regardless of whether or not they use template arguments. (unify): Likewise, but for unification. From-SVN: r24656
-rw-r--r--gcc/cp/ChangeLog9
-rw-r--r--gcc/cp/decl.c10
-rw-r--r--gcc/cp/pt.c8
-rw-r--r--gcc/cp/tree.c3
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/crash25.C7
5 files changed, 27 insertions, 10 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 01542f4..36d3a34 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,12 @@
+1999-01-13 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (grokdeclarator): Undo 1998-12-14 change.
+ * tree.c (build_cplus_array_type_1): Likewise.
+ * pt.c (instantiate_class_template): Remove misleading comment.
+ (tsubst_aggr_type): Substitute if there are template parameters,
+ regardless of whether or not they use template arguments.
+ (unify): Likewise, but for unification.
+
1999-01-12 Richard Henderson <rth@cygnus.com>
* cp-tree.h (flag_permissive): Declare extern.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index edad0a9..bf887d2 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -9890,9 +9890,13 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
&& TREE_TYPE (size) == TREE_TYPE (TREE_OPERAND (size, 0)))
size = TREE_OPERAND (size, 0);
- /* If this involves a template parameter, it'll be
- constant, but we don't know what the value is yet. */
- if (uses_template_parms (size))
+ /* If this involves a template parameter, it will be a
+ constant at instantiation time, but we don't know
+ what the value is yet. Even if no template
+ parameters are involved, we may an expression that
+ is not a constant; we don't even simplify `1 + 2'
+ when processing a template. */
+ if (processing_template_decl)
{
/* Resolve a qualified reference to an enumerator or
static const data member of ours. */
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 9a0545e..fea1c34 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -4475,9 +4475,7 @@ instantiate_class_template (type)
struct S<int> {};
Now, the `S<U>' in `f<int>' is the specialization, not an
- instantiation of the original template. Mark the type as
- complete, in the same way that we do for a definition of a
- template class. */
+ instantiation of the original template. */
goto end;
/* Determine what specialization of the original template to
@@ -5043,7 +5041,7 @@ tsubst_aggr_type (t, args, in_decl, entering_scope)
/* else fall through */
case ENUMERAL_TYPE:
case UNION_TYPE:
- if (uses_template_parms (t))
+ if (TYPE_TEMPLATE_INFO (t))
{
tree argvec;
tree context;
@@ -7671,7 +7669,7 @@ unify (tparms, targs, parm, arg, strict, explicit_mask)
if (TREE_CODE (arg) != TREE_CODE (parm))
return 1;
- if (CLASSTYPE_TEMPLATE_INFO (parm) && uses_template_parms (parm))
+ if (CLASSTYPE_TEMPLATE_INFO (parm))
{
tree t = NULL_TREE;
if (strict & UNIFY_ALLOW_DERIVED)
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 486b4c4..fdf46cf 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -416,8 +416,7 @@ build_cplus_array_type_1 (elt_type, index_type)
saveable_obstack = &permanent_obstack;
}
- if (uses_template_parms (elt_type)
- || uses_template_parms (index_type))
+ if (processing_template_decl)
{
t = make_node (ARRAY_TYPE);
TREE_TYPE (t) = elt_type;
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash25.C b/gcc/testsuite/g++.old-deja/g++.pt/crash25.C
new file mode 100644
index 0000000..f587585
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/crash25.C
@@ -0,0 +1,7 @@
+// Build don't link:
+
+template <class T>
+void f()
+{
+ int i[1 << 3];
+}