diff options
author | lerdsuwa <lerdsuwa@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-17 15:41:46 +0000 |
---|---|---|
committer | lerdsuwa <lerdsuwa@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-17 15:41:46 +0000 |
commit | c04baa536b30b91e31688f978004d36e589bbe44 (patch) | |
tree | 595c9d55452a0d493a68f4caf4ea21d82b3b3b6d /gcc/cp/pt.c | |
parent | 84a81d890ce300b03b342fcfd000061824ad0fe9 (diff) | |
download | gcc-c04baa536b30b91e31688f978004d36e589bbe44.tar.gz |
PR c++/2513
* decl.c (make_typename_type): Use dependent_type_p.
(make_unbound_class_template): Likewise.
* pt.c (instantiate_class_template): Increment
processing_template_decl during substitution of template friend
function. Preincrement processing_template_decl rather than
postincrement.
(get_mostly_instantiated_function_type): Increment
processing_template_decl during partial substitution of function
type.
* g++.dg/template/typename5.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72611 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r-- | gcc/cp/pt.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 909eede693d..ffc347c7a01 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -5294,10 +5294,10 @@ instantiate_class_template (tree type) tree r; if (TREE_CODE (t) == TEMPLATE_DECL) - processing_template_decl++; + ++processing_template_decl; r = tsubst (t, args, tf_error, NULL_TREE); if (TREE_CODE (t) == TEMPLATE_DECL) - processing_template_decl--; + --processing_template_decl; set_current_access_from_decl (r); grok_special_member_properties (r); finish_member_declaration (r); @@ -5317,10 +5317,10 @@ instantiate_class_template (tree type) input_location = DECL_SOURCE_LOCATION (t); if (TREE_CODE (t) == TEMPLATE_DECL) - processing_template_decl++; + ++processing_template_decl; r = tsubst (t, args, tf_error | tf_warning, NULL_TREE); if (TREE_CODE (t) == TEMPLATE_DECL) - processing_template_decl--; + --processing_template_decl; if (TREE_CODE (r) == VAR_DECL) { tree init; @@ -5412,9 +5412,17 @@ instantiate_class_template (tree type) --processing_template_decl; } else - /* Build new DECL_FRIENDLIST. */ - add_friend (type, tsubst_friend_function (t, args), - /*complain=*/false); + { + /* Build new DECL_FRIENDLIST. */ + tree r; + + if (TREE_CODE (t) == TEMPLATE_DECL) + ++processing_template_decl; + r = tsubst_friend_function (t, args); + if (TREE_CODE (t) == TEMPLATE_DECL) + --processing_template_decl; + add_friend (type, r, /*complain=*/false); + } } } @@ -11246,9 +11254,11 @@ get_mostly_instantiated_function_type (tree decl) specialized or not. */ push_access_scope (decl); + ++processing_template_decl; /* Now, do the (partial) substitution to figure out the appropriate function type. */ fn_type = tsubst (fn_type, partial_args, tf_error, NULL_TREE); + --processing_template_decl; /* Substitute into the template parameters to obtain the real innermost set of parameters. This step is important if the |