This patch is not quite correct. Given:
typedef int A;
typedef signed int B;
struct S { A a : 1; B b : 1; };
... -funsigned-bitfields should give 'a' an unsigned type and 'b' a signed
type.
In C++, this is non-conforming -- 'plain' bitfields are required to be
signed in C++, since otherwise you would get incoherent behavior inside
class templates -- and I'd like us to reject the flag in C++ mode unless
there's some strong compatibility argument.
In C99 onwards, this behavior is conforming but makes no sense in some
cases, since the same typedef can be redeclared with and without an
explicit 'signed' type specifier. We should diagnose such cases.
What is the motivation for allowing this?
On Mon Jan 27 2014 at 9:10:38 AM, Artyom Skrobov <[email protected]>
wrote:
> Hello,
>
> The attached patch adds the support for -funsigned-bitfields and
> -fsigned-bitfields command-line options, as available in GCC.
>
> Regarding the implementation: DeclSpec::TypeSpecSign for a bitfield was not
> accessible directly via the FieldDecl, so it took a bit of
> plumbing-through.
>
> OK to commit?_______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits