aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/semantics.c
diff options
context:
space:
mode:
authorabutcher <abutcher@138bc75d-0d04-0410-961f-82ee72b054a4>2017-01-27 07:59:06 +0000
committerabutcher <abutcher@138bc75d-0d04-0410-961f-82ee72b054a4>2017-01-27 07:59:06 +0000
commit59fdc96f09576a266a56b8f0a9d2e4f9bab49d3f (patch)
tree6d74a0c4c4c060c5f3cb24e32b23ffef3968df5b /gcc/cp/semantics.c
parent0e6c1ca67570fbbc34c838cafc8fbf0b47337de8 (diff)
Fix PR c++/64382
PR c++/64382 * cp/parser.c (parsing_default_capturing_generic_lambda_in_template): New function. * cp/cp-tree.h: Declare it. * cp/semantics.c (finish_id_expression): Resolve names within a default capturing generic lambda defined within a template prior to instantiation to allow for captures to be added to the closure type. PR c++/64382 * g++.dg/cpp1y/pr64382.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244962 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r--gcc/cp/semantics.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 6d5ea955db3..42b555c5883 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -3563,9 +3563,13 @@ finish_id_expression (tree id_expression,
? CP_ID_KIND_UNQUALIFIED_DEPENDENT
: CP_ID_KIND_UNQUALIFIED)));
- /* If the name was dependent on a template parameter, we will
- resolve the name at instantiation time. */
- if (dependent_p)
+ /* If the name was dependent on a template parameter and we're not in a
+ default capturing generic lambda within a template, we will resolve the
+ name at instantiation time. FIXME: For lambdas, we should defer
+ building the closure type until instantiation time then we won't need
+ the extra test here. */
+ if (dependent_p
+ && !parsing_default_capturing_generic_lambda_in_template ())
{
if (DECL_P (decl)
&& any_dependent_type_attributes_p (DECL_ATTRIBUTES (decl)))