aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>1999-10-01 17:25:05 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-10-01 17:25:05 +0000
commitb3da7bb1cfd62e0ad61e661e428f0af2124ee5e1 (patch)
tree694d7ced2e4915115bb5bcf49f7941a944c10e7e /gcc
parent2816d1644f17de74f9065f2a2f2af48555e13b11 (diff)
downloadgcc-b3da7bb1cfd62e0ad61e661e428f0af2124ee5e1.zip
gcc-b3da7bb1cfd62e0ad61e661e428f0af2124ee5e1.tar.gz
gcc-b3da7bb1cfd62e0ad61e661e428f0af2124ee5e1.tar.bz2
pt.c (tsubst_decl): If the type of a template instantiation is bogus, so is the whole instantiation.
* pt.c (tsubst_decl): If the type of a template instantiation is bogus, so is the whole instantiation. From-SVN: r29757
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/pt.c2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/error2.C15
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/typename8.C6
4 files changed, 25 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a97890d..bef91e9 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+1999-10-01 Mark Mitchell <mark@codesourcery.com>
+
+ * pt.c (tsubst_decl): If the type of a template instantiation is
+ bogus, so is the whole instantiation.
+
1999-09-30 Mark Mitchell <mark@codesourcery.com>
* decl.c (initialize_local_var): Handle static variables here.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 5b7c181..fca18cc 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -5778,6 +5778,8 @@ tsubst_decl (t, args, type, in_decl)
ctx = NULL_TREE;
}
type = tsubst (type, args, /*complain=*/1, in_decl);
+ if (type == error_mark_node)
+ return error_mark_node;
/* We do NOT check for matching decls pushed separately at this
point, as they may not represent instantiations of this
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/error2.C b/gcc/testsuite/g++.old-deja/g++.pt/error2.C
new file mode 100644
index 0000000..21518aa
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/error2.C
@@ -0,0 +1,15 @@
+// Build don't link:
+// Origin: Carl Nygard <cnygard@bellatlantic.net>
+
+template <class RT>
+class Test { // ERROR - in instantiation
+public:
+ Test(const RT& c = RT()) {} // ERROR - reference to void
+};
+
+void f ()
+{
+ Test<void> c; // ERROR - instantiated from here
+}
+
+
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/typename8.C b/gcc/testsuite/g++.old-deja/g++.pt/typename8.C
index 86881f5..5e5f2f0 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/typename8.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/typename8.C
@@ -11,7 +11,7 @@ public:
t=_t;
}
- anotherT getT() {
+ anotherT getT() { // ERROR - undefined type
return t;
}
};
@@ -20,8 +20,8 @@ class B : public A< B > // ERROR - forward declaration
{
public:
typedef int myT;
-};
+}; // ERROR - base with non-default constructor
int main() {
- B b;
+ B b; // ERROR - no constructor
}