cp_parser_attributes_opt doesn't accept GNU attributes followed by
[[]] attributes and vice versa; only a sequence of attributes of the
same kind. That causes grief for code like:
struct __attribute__ ((may_alias)) alignas (2) struct S { };
or
#define EXPORT __attribute__((visibility("default")))
struct [[nodiscard]] EXPORT F { };
It doesn't seem to a documented restriction, so this patch fixes the
problem.
However, the patch does not touch the C FE. The C FE doesn't have
a counterpart to C++'s cp_parser_attributes_opt -- it only has
c_parser_transaction_attributes (which parses both GNU and [[]]
attributes), but that's TM-specific. The C FE seems to use either
c_parser_gnu_attributes or c_parser_std_attribute_specifier_sequence.
As a consequence, this works: