Commit a171a8bb by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/86550 (Lambda parsing allows arbitrary types in decl-specifier-seq)

	PR c++/86550
	* parser.c (cp_parser_decl_specifier_seq): Diagnose invalid type
	specifier if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR.

	* g++.dg/cpp0x/lambda/lambda-86550.C: New test.

From-SVN: r262862
parent 6f41f92b
2018-07-18 Jakub Jelinek <jakub@redhat.com>
PR c++/86550
* parser.c (cp_parser_decl_specifier_seq): Diagnose invalid type
specifier if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR.
2018-07-18 Marek Polacek <polacek@redhat.com> 2018-07-18 Marek Polacek <polacek@redhat.com>
PR c++/86190 - bogus -Wsign-conversion warning PR c++/86190 - bogus -Wsign-conversion warning
......
...@@ -13797,6 +13797,9 @@ cp_parser_decl_specifier_seq (cp_parser* parser, ...@@ -13797,6 +13797,9 @@ cp_parser_decl_specifier_seq (cp_parser* parser,
found_decl_spec = true; found_decl_spec = true;
if (!is_cv_qualifier) if (!is_cv_qualifier)
decl_specs->any_type_specifiers_p = true; decl_specs->any_type_specifiers_p = true;
if ((flags & CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR) != 0)
error_at (token->location, "type-specifier invalid in lambda");
} }
} }
2018-07-18 Jakub Jelinek <jakub@redhat.com>
PR c++/86550
* g++.dg/cpp0x/lambda/lambda-86550.C: New test.
2018-07-18 Bernd Edlinger <bernd.edlinger@hotmail.de> 2018-07-18 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR 69558 PR 69558
......
// PR c++/86550
// { dg-do compile { target c++11 } }
void
foo ()
{
auto a = []() bool {}; // { dg-error "type-specifier invalid in lambda" }
auto b = []() bool bool bool bool int {}; // { dg-error "type-specifier invalid in lambda" }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment