C++ PATCH for c++/51507 (pack expansion in trailing-return-type)

Jason Merrill jason@redhat.com
Fri Dec 23 22:14:00 GMT 2011


The existing code to handle pack expansions in trailing-return-type 
assumed that such expansions would only occur inside decltype, which is 
not the case.  This patch fixes the test to check for whether or not 
we're doing the substitution in the context of a function body, and 
fixes at_function_scope_p to properly return false when we're 
substituting deduced arguments into a candidate function template.

Even with the change to at_function_scope_p it was impossible to tell 
that we weren't in function scope when instantiating a function 
declaration as part of overload resolution, so I also changed 
instantiate_template_1 to use push_to_top_level rather than just clear 
processing_template_decl.  In my testing it was enough to just clear 
current_function_decl as well, but since in fact the instantiation 
happens at top level it seems more correct to use push_to_top_level.

The second patch is a bug I noticed in dependent_name while working on 
this patch, though it isn't necessary to this patch; a BASELINK should 
not be considered a dependent name, or we end up treating calls to 
members of different classes as equivalent.

Tested x86_64-pc-linux-gnu, applying to trunk.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 51507.patch
Type: text/x-patch
Size: 4310 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20111223/f9ee57d3/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dep-name.patch
Type: text/x-patch
Size: 638 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20111223/f9ee57d3/attachment-0001.bin>


More information about the Gcc-patches mailing list