2019-11-26 Jakub Jelinek <jakub@redhat.com>
+ PR c++/92648
+ * parser.c (cp_parser_std_attribute): For unknown attributes,
+ skip balanced token seq instead of trying to parse
+ attribute-argument-clause as expression list. Formatting fix.
+
PR c++/61414
* class.c (enum_to_min_precision): New hash_map.
(enum_min_precision): New function.
/* A GNU attribute that takes an identifier in parameter. */
attr_flag = id_attr;
+ if (as == NULL)
+ {
+ /* For unknown attributes, just skip balanced tokens instead of
+ trying to parse the arguments. */
+ for (size_t n = cp_parser_skip_balanced_tokens (parser, 1) - 1; n; --n)
+ cp_lexer_consume_token (parser->lexer);
+ return attribute;
+ }
+
vec = cp_parser_parenthesized_expression_list
(parser, attr_flag, /*cast_p=*/false,
/*allow_expansion_p=*/true,
arguments = error_mark_node;
else
{
- if (vec->is_empty())
+ if (vec->is_empty ())
/* e.g. [[attr()]]. */
error_at (token->location, "parentheses must be omitted if "
"%qE attribute argument list is empty",
2019-11-26 Jakub Jelinek <jakub@redhat.com>
+ PR c++/92648
+ * g++.dg/cpp0x/gen-attrs-71.C: New test.
+
PR c++/61414
* g++.dg/cpp0x/enum23.C: Remove xfail.
* g++.dg/cpp0x/enum28.C: New test.
--- /dev/null
+// PR c++/92648
+// { dg-do compile { target c++11 } }
+
+int a [[gnu::no_such_attribute(![!(!)!]!,;;)]]; // { dg-warning "ignored" }
+int b [[no_such_namespace::nonexisting_attribute(linear(c, d : 2), reduction(*:e), linear(uval (f)))]]; // { dg-warning "ignored" }
+int c [[gnu::nonexisting_attribute()]]; // { dg-warning "ignored" }
+int d [[gnu::another_nonexistent_attr(1,"abcd",g+6)]]; // { dg-warning "ignored" }