re PR c++/59349 (ICE on invalid: Segmentation fault toplev.c:336)
[gcc.git] / gcc / cp / parser.c
index 2a2cbf0f0610715d2afdadb40c7bbf29fa753ab8..4ef0f05c9bebd50f27ccf16b5d984dddaf671961 100644 (file)
@@ -8898,6 +8898,11 @@ cp_parser_lambda_introducer (cp_parser* parser, tree lambda_expr)
          capture_init_expr = cp_parser_initializer (parser, &direct,
                                                     &non_constant);
          explicit_init_p = true;
+         if (capture_init_expr == NULL_TREE)
+           {
+             error ("empty initializer for lambda init-capture");
+             capture_init_expr = error_mark_node;
+           }
        }
       else
        {