[Sema] Don't allow unverified bitfields in FieldDecls
VerifyBitField must be called if we are to form a bitfield FieldDecl. We will not verify the bitfield if the decl is known to be malformed in other ways; pretend that we don't have a bitfield if this happens. llvm-svn: 235816
This commit is contained in:
parent
9fc700e76d
commit
8702b5215e
|
@ -12481,8 +12481,10 @@ FieldDecl *Sema::CheckFieldDecl(DeclarationName Name, QualType T,
|
|||
InvalidDecl = true;
|
||||
|
||||
bool ZeroWidth = false;
|
||||
if (InvalidDecl)
|
||||
BitWidth = nullptr;
|
||||
// If this is declared as a bit-field, check the bit-field.
|
||||
if (!InvalidDecl && BitWidth) {
|
||||
if (BitWidth) {
|
||||
BitWidth = VerifyBitField(Loc, II, T, Record->isMsStruct(Context), BitWidth,
|
||||
&ZeroWidth).get();
|
||||
if (!BitWidth) {
|
||||
|
|
|
@ -74,3 +74,7 @@ typedef __typeof__(+(--t5.n)) Signed; // This should not promote to signed.
|
|||
|
||||
typedef __typeof__(+(t5.n++)) Unsigned; // Post-increment is underspecified, but seems to
|
||||
typedef __typeof__(+(t5.n--)) Unsigned; // also act like compound-assignment.
|
||||
|
||||
struct Test6 {
|
||||
: 0.0; // expected-error{{type name requires a specifier or qualifier}}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue