diff options
author | Mark Mitchell <mark@codesourcery.com> | 2006-06-16 02:09:10 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2006-06-16 02:09:10 +0000 |
commit | a95799ec5fe4e00d99fc1545ff0ea64d10e7e0b9 (patch) | |
tree | 462bb323dcfbee6531d4cdcd154b78f02a6234de /gcc/cp | |
parent | 9f84b5ae284ca20b0e62d5d848e9f033471582db (diff) | |
download | gcc-a95799ec5fe4e00d99fc1545ff0ea64d10e7e0b9.zip gcc-a95799ec5fe4e00d99fc1545ff0ea64d10e7e0b9.tar.gz gcc-a95799ec5fe4e00d99fc1545ff0ea64d10e7e0b9.tar.bz2 |
re PR c++/27640 (segfault, related to constructor instantiation and virtual base case and templates and new operator)
PR c++/27640
* pt.c (instantiate_template): Set processing_template_decl to
zero while performing substitutions.
PR c++/27640
* g++.dg/template/ctor7.C: New test.
From-SVN: r114701
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/pt.c | 11 |
2 files changed, 16 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 78e4ed8..f80d362 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2006-06-15 Mark Mitchell <mark@codesourcery.com> + + PR c++/27640 + * pt.c (instantiate_template): Set processing_template_decl to + zero while performing substitutions. + 2006-06-14 Mark Mitchell <mark@codesourcery.com> PR c++/27665 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 0cc93fd..d25ea79 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -9233,6 +9233,7 @@ instantiate_template (tree tmpl, tree targ_ptr, tsubst_flags_t complain) tree fndecl; tree gen_tmpl; tree spec; + HOST_WIDE_INT saved_processing_template_decl; if (tmpl == error_mark_node) return error_mark_node; @@ -9292,9 +9293,17 @@ instantiate_template (tree tmpl, tree targ_ptr, tsubst_flags_t complain) deferring all checks until we have the FUNCTION_DECL. */ push_deferring_access_checks (dk_deferred); - /* Substitute template parameters. */ + /* Although PROCESSING_TEMPLATE_DECL may be true at this point + (because, for example, we have encountered a non-dependent + function call in the body of a template function must determine + which of several overloaded functions will be called), within the + instantiation itself we are not processing a template. */ + saved_processing_template_decl = processing_template_decl; + processing_template_decl = 0; + /* Substitute template parameters to obtain the specialization. */ fndecl = tsubst (DECL_TEMPLATE_RESULT (gen_tmpl), targ_ptr, complain, gen_tmpl); + processing_template_decl = saved_processing_template_decl; if (fndecl == error_mark_node) return error_mark_node; |