Use a range for LAMBDA_EXPR_LOCATION.
authorJason Merrill <jason@redhat.com>
Tue, 19 Jun 2018 00:38:38 +0000 (20:38 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 19 Jun 2018 00:38:38 +0000 (20:38 -0400)
* parser.c (cp_parser_lambda_expression): Use a range for
LAMBDA_EXPR_LOCATION.

From-SVN: r261727

gcc/cp/ChangeLog
gcc/cp/parser.c

index a671476267545fdfbd134ce75ac81fc7dae8fddc..3e3b61038324b36107a361e5f571eeff7e97376f 100644 (file)
@@ -1,5 +1,8 @@
 2018-06-18  Jason Merrill  <jason@redhat.com>
 
+       * parser.c (cp_parser_lambda_expression): Use a range for
+       LAMBDA_EXPR_LOCATION.
+
        PR c++/86200 - ICE with unexpanded pack in lambda parameter.
        * pt.c (find_parameter_packs_r) [LAMBDA_EXPR]: Also look into the
        function type.
index edb0ef8025ef431a8335289a6db9a4182b15fabc..ae9267e6d83c4319d875f4e0ddd49b82f03a8894 100644 (file)
@@ -10198,6 +10198,12 @@ cp_parser_lambda_expression (cp_parser* parser)
   /* And now that we're done, push proxies for an enclosing lambda.  */
   insert_pending_capture_proxies ();
 
+  /* Update the lambda expression to a range.  */
+  cp_token *end_tok = cp_lexer_previous_token (parser->lexer);
+  LAMBDA_EXPR_LOCATION (lambda_expr) = make_location (token->location,
+                                                     token->location,
+                                                     end_tok->location);
+
   if (ok)
     lambda_expr = build_lambda_object (lambda_expr);
   else