From 0401d3842471d3f5c8f1613e8d8b4f8a2fbed4d7 Mon Sep 17 00:00:00 2001 From: mmitchel Date: Fri, 1 Oct 1999 17:25:05 +0000 Subject: [PATCH] * pt.c (tsubst_decl): If the type of a template instantiation is bogus, so is the whole instantiation. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29757 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/pt.c | 2 ++ gcc/testsuite/g++.old-deja/g++.pt/error2.C | 15 +++++++++++++++ gcc/testsuite/g++.old-deja/g++.pt/typename8.C | 6 +++--- 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/error2.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a97890d86fc..bef91e9492c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +1999-10-01 Mark Mitchell + + * pt.c (tsubst_decl): If the type of a template instantiation is + bogus, so is the whole instantiation. + 1999-09-30 Mark Mitchell * decl.c (initialize_local_var): Handle static variables here. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 5b7c181ab94..fca18cce70d 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 00000000000..21518aac525 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/error2.C @@ -0,0 +1,15 @@ +// Build don't link: +// Origin: Carl Nygard + +template +class Test { // ERROR - in instantiation +public: + Test(const RT& c = RT()) {} // ERROR - reference to void +}; + +void f () +{ + Test 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 86881f51127..5e5f2f07505 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 } -- 2.11.4.GIT