diff options
author | Mark Mitchell <mark@codesourcery.com> | 2006-04-30 23:21:38 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2006-04-30 23:21:38 +0000 |
commit | 5a8613b2d973ff0885dae81e92daf97982fc2ea1 (patch) | |
tree | 7e2fac46ae217590a820213c76c4b19d541dacd9 /gcc/cp/decl2.c | |
parent | 194c524aa2f34e1389c4ddd31b20eea15eae00bb (diff) | |
download | gcc-5a8613b2d973ff0885dae81e92daf97982fc2ea1.zip gcc-5a8613b2d973ff0885dae81e92daf97982fc2ea1.tar.gz gcc-5a8613b2d973ff0885dae81e92daf97982fc2ea1.tar.bz2 |
re PR c++/27094 (tree check: expected tree_list, have omp_return in build_call)
PR c++/27094
* pt.c (tsubst_default_argument): Increment function_depth around
call to tsubst_expr.
* parser.c (cp_parser_parameter_declaration): Likewise.
* decl2.c (mark_used): Tidy.
PR c++/27094
* g++.dg/template/defarg8.C: New test.
From-SVN: r113399
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r-- | gcc/cp/decl2.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index fe5db71..df85e4c 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -3319,29 +3319,28 @@ mark_used (tree decl) { synthesize_method (decl); /* If we've already synthesized the method we don't need to - instantiate it, so we can return right away. */ - return; - } - - /* If this is a function or variable that is an instance of some - template, we now know that we will need to actually do the - instantiation. We check that DECL is not an explicit - instantiation because that is not checked in instantiate_decl. */ - if ((DECL_NON_THUNK_FUNCTION_P (decl) || TREE_CODE (decl) == VAR_DECL) - && DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INFO (decl) - && (!DECL_EXPLICIT_INSTANTIATION (decl) - || (TREE_CODE (decl) == FUNCTION_DECL - && DECL_INLINE (DECL_TEMPLATE_RESULT - (template_for_substitution (decl)))) - /* We need to instantiate static data members so that there - initializers are available in integral constant - expressions. */ - || (TREE_CODE (decl) == VAR_DECL - && DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl)))) - /* We put off instantiating functions in order to improve compile + do the instantiation test below. */ + } + else if ((DECL_NON_THUNK_FUNCTION_P (decl) || TREE_CODE (decl) == VAR_DECL) + && DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INFO (decl) + && (!DECL_EXPLICIT_INSTANTIATION (decl) + || (TREE_CODE (decl) == FUNCTION_DECL + && DECL_INLINE (DECL_TEMPLATE_RESULT + (template_for_substitution (decl)))) + /* We need to instantiate static data members so that there + initializers are available in integral constant + expressions. */ + || (TREE_CODE (decl) == VAR_DECL + && DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl)))) + /* If this is a function or variable that is an instance of some + template, we now know that we will need to actually do the + instantiation. We check that DECL is not an explicit + instantiation because that is not checked in instantiate_decl. + + We put off instantiating functions in order to improve compile times. Maintaining a stack of active functions is expensive, and the inliner knows to instantiate any functions it might - need. */ + need. Therefore, we always try to defer instantiation. */ instantiate_decl (decl, /*defer_ok=*/true, /*expl_inst_class_mem_p=*/false); |