pt.c (tsubst_decl): If the type of a template instantiation is bogus, so is the whole...
authorMark Mitchell <mark@codesourcery.com>
Fri, 1 Oct 1999 17:25:05 +0000 (17:25 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Fri, 1 Oct 1999 17:25:05 +0000 (17:25 +0000)
* pt.c (tsubst_decl): If the type of a template instantiation is
bogus, so is the whole instantiation.

From-SVN: r29757

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.old-deja/g++.pt/error2.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/typename8.C

index a97890d86fcbbb9d0d035b56ab7884a17b670ba9..bef91e9492c8cefd01d079eb1ec56830a628dd1c 100644 (file)
@@ -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.
index 5b7c181ab947da0a13c87c45bbf26b8c34d98bdd..fca18cce70db4130ea070880222d582128e3924f 100644 (file)
@@ -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 (file)
index 0000000..21518aa
--- /dev/null
@@ -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
+}
+
+
index 86881f5112726dee0c4a85b331b2b09030f53fc3..5e5f2f07505b25f04385250d3a9ca880921dc9a7 100644 (file)
@@ -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
 }