aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2000-11-17 10:24:05 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2000-11-17 10:24:05 +0000
commit35728a80fc263329299d40fc81ed3dfffd164cf0 (patch)
tree4855606a5930e0061f5125564877ab956b83e0a8 /gcc
parent5cce22b6c2bfebd556b36a9c89d1bdf3eee900ae (diff)
downloadgcc-35728a80fc263329299d40fc81ed3dfffd164cf0.zip
gcc-35728a80fc263329299d40fc81ed3dfffd164cf0.tar.gz
gcc-35728a80fc263329299d40fc81ed3dfffd164cf0.tar.bz2
pt.c (tsubst_expr, DECL_STMT): Instantiate decl's type.
cp: * pt.c (tsubst_expr, DECL_STMT): Instantiate decl's type. testsuite: * g++.old-deja/g++.pt/instantiate8.C: New test. From-SVN: r37518
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/pt.c3
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/instantiate8.C40
4 files changed, 51 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1cbeac8..63f97f4 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2000-11-17 Nathan Sidwell <nathan@codesourcery.com>
+ * pt.c (tsubst_expr, DECL_STMT): Instantiate decl's type.
+
+2000-11-17 Nathan Sidwell <nathan@codesourcery.com>
+
* cp-tree.h (PARMLIST_ELLIPSIS_P): New macro.
* decl.c (grokdeclarator): Don't reject void parms here.
(require_complete_types_for_parms): Simplify, use
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index dd190ea..c281636 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -7150,6 +7150,9 @@ tsubst_expr (t, args, complain, in_decl)
init = tsubst_expr (init, args, complain, in_decl);
if (decl != error_mark_node)
{
+ if (TREE_CODE (decl) != TYPE_DECL)
+ /* Make sure the type is instantiated now. */
+ complete_type (type);
if (init)
DECL_INITIAL (decl) = error_mark_node;
/* By marking the declaration as instantiated, we avoid
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b6acd13..382b519 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,9 @@
2000-11-17 Nathan Sidwell <nathan@codesourcery.com>
+ * g++.old-deja/g++.pt/instantiate8.C: New test.
+
+2000-11-17 Nathan Sidwell <nathan@codesourcery.com>
+
* g++.old-deja/g++.other/incomplete.C: Add more tests.
* g++.old-deja/g++.pt/crash9.C: Mark new expected error.
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/instantiate8.C b/gcc/testsuite/g++.old-deja/g++.pt/instantiate8.C
new file mode 100644
index 0000000..beffa02
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/instantiate8.C
@@ -0,0 +1,40 @@
+// Build don't link:
+// Copyright (C) 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 14 Nov 2000 <nathan@codesourcery.com>
+
+// bug 616. We failed to complete the type of decls in templates, leading to
+// bogus errors.
+
+struct Z;
+struct Y
+{
+ Y (int i = 1);
+};
+void g ()
+{
+ const Y y;
+ Z z; // ERROR - incomplete
+}
+
+template <int dim>
+struct X
+{
+ X (int i=1);
+};
+
+void h ()
+{
+ const X<2> z;
+ Z z1; // ERROR - incomplete
+}
+
+template <int dim>
+void f()
+{
+ const X<dim> x;
+ const X<dim+1> y[3];
+ Z z2; // ERROR - incomplete
+ typedef Z z3; // ok
+};
+
+template void f<3> ();