]> gcc.gnu.org Git - gcc.git/commitdiff
pt.c (instantiate_class_template): Don't instantiate if pedantic and the args use...
authorJason Merrill <jason@yorick.cygnus.com>
Tue, 24 Feb 1998 01:41:45 +0000 (01:41 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 24 Feb 1998 01:41:45 +0000 (20:41 -0500)
* pt.c (instantiate_class_template): Don't instantiate if pedantic
and the args use template parms.
* pt.c (push_tinst_level): If the instantiaton uses template parms,
fail silently.
* decl.c (xref_basetypes): Do call complete_type for basetypes
that involve template parameters.

From-SVN: r18215

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/pt.c

index 75ff86cdd0532aec37c23d58e3bbe154c9dfe7f5..757a1fd238944ed8c315c85a47a4ad21e7d125b5 100644 (file)
@@ -1,3 +1,13 @@
+Tue Feb 24 01:40:24 1998  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * pt.c (instantiate_class_template): Don't instantiate if pedantic
+       and the args use template parms.
+
+       * pt.c (push_tinst_level): If the instantiaton uses template parms,
+       fail silently.
+       * decl.c (xref_basetypes): Do call complete_type for basetypes
+       that involve template parameters.
+
 Tue Feb 24 00:36:43 1998  Jason Merrill  <jason@yorick.cygnus.com>
 
        * typeck2.c (process_init_constructor): Fix labeled init check.
index 7ba992a163edb2380cd249b44c5b9316deabc7ea..df260a304cdb22f42f049ac90d5c72687c8d7f4d 100644 (file)
@@ -11038,9 +11038,10 @@ xref_basetypes (code_type_node, name, ref, binfo)
          continue;
        }
 #if 1
-      /* This code replaces similar code in layout_basetypes.  */
-      else if (! (current_template_parms && uses_template_parms (basetype))
-              && TYPE_SIZE (complete_type (basetype)) == NULL_TREE)
+      /* This code replaces similar code in layout_basetypes.
+         We put the complete_type first for implicit `typename'.  */
+      else if (TYPE_SIZE (complete_type (basetype)) == NULL_TREE
+              && ! (current_template_parms && uses_template_parms (basetype)))
        {
          cp_error ("base class `%T' has incomplete type", basetype);
          continue;
index c6d8f183f6acb822180880c2bf7e7ca565d92f2d..d70bc62f27ce7172c6865129f8aee50bd366b9ab 100644 (file)
@@ -2749,6 +2749,12 @@ push_tinst_level (d)
       int line = lineno;
       char *file = input_filename;
 
+      /* If the instantiation in question still has unbound template parms,
+        we don't really care if we can't instantiate it, so just return.
+         This happens with base instantiation for implicit `typename'.  */
+      if (uses_template_parms (d))
+       return 0;
+
       error ("template instantiation depth exceeds maximum of %d",
             max_tinst_depth);
       error (" (use -ftemplate-depth-NN to increase the maximum)");
@@ -2951,6 +2957,13 @@ instantiate_class_template (type)
   if (t)
     args = get_class_bindings (TREE_VALUE (t), TREE_PURPOSE (t), args);
 
+  if (pedantic && uses_template_parms (args))
+    /* If there are still template parameters amongst the args, then
+       we can't instantiate the type; there's no telling whether or not one
+       of the template parameters might eventually be instantiated to some
+       value that results in a specialization being used.  */
+    return type;
+
   TYPE_BEING_DEFINED (type) = 1;
 
   if (! push_tinst_level (type))
This page took 0.125288 seconds and 5 git commands to generate.