8sa1-gcc/gcc/testsuite/g++.dg/cpp1z/attr-lambda1.C
Jakub Jelinek 628be4ef70 re PR c++/89640 (g++ chokes on lambda with __attribute__)
PR c++/89640
	* parser.c (cp_parser_decl_specifier_seq): Don't parse attributes
	if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR.

	* g++.dg/cpp1z/attr-lambda1.C: New test.
	* g++.dg/ext/attr-lambda2.C: New test.

From-SVN: r277741
2019-11-02 07:53:53 +01:00

13 lines
501 B
C

// PR c++/89640
// { dg-options "-Wno-attributes" }
// { dg-do compile { target c++17 } }
void test() {
[]() mutable [[gnu::cold]] constexpr {}(); // { dg-error "expected" }
[]() constexpr [[gnu::cold]] mutable {}(); // { dg-error "expected" }
[]() [[gnu::cold]] mutable constexpr {}(); // { dg-error "expected" }
[]() [[gnu::cold]] constexpr mutable {}(); // { dg-error "expected" }
[]() mutable constexpr [[gnu::cold]] {}();
[]() constexpr mutable [[gnu::cold]] {}();
}