Better diagnostics for anonymous bit-fields with attributes or an initializer.
authorAaron Ballman <aaron@aaronballman.com>
Tue, 29 Sep 2020 20:27:51 +0000 (16:27 -0400)
committerAaron Ballman <aaron@aaronballman.com>
Tue, 29 Sep 2020 20:32:20 +0000 (16:32 -0400)
commit538762fef0b662048be2a261ebc12da249efa977
tree9fbb656f7a5e635b3999cd84c0f8be9d5b29409e
parentf9e70fa546a461b3c9fa8463efcd9f7fe989bd9f
Better diagnostics for anonymous bit-fields with attributes or an initializer.

The current C++ grammar allows an anonymous bit-field with an attribute,
but this is ambiguous (the attribute in that case could appertain to the
type instead of the bit-field). The current thinking in the Core Working
Group is that it's better to disallow attributes in that position at the
grammar level so that the ambiguity resolves in favor of applying to the
type.

During discussions about the behavior of the attribute, the Core Working
Group also felt it was better to disallow anonymous bit-fields from
specifying a default member initializer.

This implements both sets of related grammar changes.
clang/include/clang/Basic/DiagnosticParseKinds.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Parse/ParseDecl.cpp
clang/lib/Parse/ParseDeclCXX.cpp
clang/lib/Sema/SemaDecl.cpp
clang/test/CXX/class/class.bit/p1.cpp [new file with mode: 0644]
clang/test/Parser/MicrosoftExtensions.cpp
clang/test/Parser/c2x-attributes.c