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: [PATCH] Fix PR c++/66786 (ICE with nested lambdas in variable template)


On 02/08/2016 12:19 AM, Patrick Palka wrote:
Here, we are calling template_class_depth on a FIELD_DECL corresponding
to a lambda that is used inside variable template.  template_class_depth
however does not see that this FIELD_DECL is used inside a variable
template binding because its chain of DECL_CONTEXTs does not include the
corresponding VAR_DECL.  So template_class_depth returns the wrong
template nesting level which causes its callers to malfunction.  In
particular we strip a template argument level in
tsubst_copy [FIELD_DECL] when we shouldn't have.

This patch makes template_class_depth look at a lambda type's
LAMBDA_TYPE_EXTRA_SCOPE field instead of its TYPE_CONTEXT, so that it
can iterate into an enclosing variable template, if applicable.

Tested on x86_64-pc-linux gnu, no new regressions.  Also tested against
Boost.  Is this OK to commit?

This is breaking several lambda testcases with -fconcepts on; LAMBDA_TYPE_EXTRA_SCOPE can also be a FIELD_DECL or PARM_DECL. Let's just check DECL_P.

Jason


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