diff options
author | Jason Merrill <jason@yorick.cygnus.com> | 1998-02-24 01:41:45 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1998-02-23 20:41:45 -0500 |
commit | 8adf5b5e7b6ee28371f5eedcf2aa8c9485cffa16 (patch) | |
tree | e3cb5205033abb6c63826ee65112b84c41b185bc /gcc | |
parent | 6c3e25ebe24f8b757d68fdfcff6c46238d24efa4 (diff) | |
download | gcc-8adf5b5e7b6ee28371f5eedcf2aa8c9485cffa16.zip gcc-8adf5b5e7b6ee28371f5eedcf2aa8c9485cffa16.tar.gz gcc-8adf5b5e7b6ee28371f5eedcf2aa8c9485cffa16.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/cp/decl.c | 7 | ||||
-rw-r--r-- | gcc/cp/pt.c | 13 |
3 files changed, 27 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 75ff86c..757a1fd 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 7ba992a..df260a3 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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; diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index c6d8f18..d70bc62 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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)) |