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
This commit is contained in:
Jakub Jelinek 2018-07-18 23:01:54 +02:00 committed by Jakub Jelinek
parent 6f41f92beb
commit a171a8bb39
4 changed files with 23 additions and 0 deletions

View File

@ -1,3 +1,9 @@
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

View File

@ -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");
} }
} }

View File

@ -1,3 +1,8 @@
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

View File

@ -0,0 +1,9 @@
// 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" }
}