This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ PATCH: PR 27640



Mark Mitchell wrote, On 16.6.2006 4:11:
> This patch fixes PR c++/27640, an ICE-on-valid regression.  The
> proximate cause was that we were failing to add the in-charge and VTT
> parameters to member template constructors if they were instantiated
> from within a template function (as part of two-phase name lookup).
> The fix is to note that when actually producing a specialization we
> are never PROCESSING_TEMPLATE_DECL.
> 
> Tested on x86_64-unknown-linux-gnu, applied on the mainline.  I will
> apply to 4.1 as soon as testing completes.
> 
> --
> Mark Mitchell
> CodeSourcery
> mark@codesourcery.com
> (650) 331-3385 x713
> 
> 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-15  Mark Mitchell  <mark@codesourcery.com>
> 
> 	PR c++/27640
> 	* g++.dg/template/ctor7.C: New test.
> 
> Index: gcc/cp/pt.c
> ===================================================================
> --- gcc/cp/pt.c	(revision 114665)
> +++ gcc/cp/pt.c	(working copy)
> @@ -9233,6 +9233,7 @@ instantiate_template (tree tmpl, tree ta
>    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 ta
>       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
Up to here the English makes sense to me ---------------^
But the rest of the sentence IMHO doesn't fit in. What must determine
which of several overloaded functions will be called?

> +     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;
[...]

--
VH

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]