Commit a95799ec by Mark Mitchell Committed by Mark Mitchell

re PR c++/27640 (segfault, related to constructor instantiation and virtual base…

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
parent 9f84b5ae
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> 2006-06-14 Mark Mitchell <mark@codesourcery.com>
PR c++/27665 PR c++/27665
......
...@@ -9233,6 +9233,7 @@ instantiate_template (tree tmpl, tree targ_ptr, tsubst_flags_t complain) ...@@ -9233,6 +9233,7 @@ instantiate_template (tree tmpl, tree targ_ptr, tsubst_flags_t complain)
tree fndecl; tree fndecl;
tree gen_tmpl; tree gen_tmpl;
tree spec; tree spec;
HOST_WIDE_INT saved_processing_template_decl;
if (tmpl == error_mark_node) if (tmpl == error_mark_node)
return error_mark_node; return error_mark_node;
...@@ -9292,9 +9293,17 @@ instantiate_template (tree tmpl, tree targ_ptr, tsubst_flags_t complain) ...@@ -9292,9 +9293,17 @@ instantiate_template (tree tmpl, tree targ_ptr, tsubst_flags_t complain)
deferring all checks until we have the FUNCTION_DECL. */ deferring all checks until we have the FUNCTION_DECL. */
push_deferring_access_checks (dk_deferred); 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), fndecl = tsubst (DECL_TEMPLATE_RESULT (gen_tmpl),
targ_ptr, complain, gen_tmpl); targ_ptr, complain, gen_tmpl);
processing_template_decl = saved_processing_template_decl;
if (fndecl == error_mark_node) if (fndecl == error_mark_node)
return error_mark_node; return error_mark_node;
......
2006-06-15 Mark Mitchell <mark@codesourcery.com>
PR c++/27640
* g++.dg/template/ctor7.C: New test.
2006-06-15 Janis Johnson <janis187@us.ibm.com> 2006-06-15 Janis Johnson <janis187@us.ibm.com>
* gcc.dg/vmx/pr27842.c: Remove dg-do directive; use default. * gcc.dg/vmx/pr27842.c: Remove dg-do directive; use default.
// PR c++/27640
template < class T > struct refcounted :
virtual T
{
template < class A1 > refcounted (const A1 & a1) : T () { }
};
struct nfsserv {};
template < class T >
void
sfsserver_cache_alloc (int *ns)
{
new refcounted < nfsserv > (*ns);
}
void
usage ()
{
sfsserver_cache_alloc < int > ( 0);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment