pt.c (instantiate_class_template): Don't instantiate if pedantic and the args use template parms.

* 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
This commit is contained in:
Jason Merrill 1998-02-24 01:41:45 +00:00 committed by Jason Merrill
parent 6c3e25ebe2
commit 8adf5b5e7b
3 changed files with 27 additions and 3 deletions

View 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.

View 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;

View 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))