diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-14 21:16:09 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-14 21:16:09 +0000 |
commit | a723ba97db0e47f024118fa9f132d307dcfc75d4 (patch) | |
tree | 93a2cc3522269080e30dbfe1a98e130738cf51e5 /clang | |
parent | 5196c618fb579ac135eccffd5f5867572d2ec372 (diff) | |
download | bcm5719-llvm-a723ba97db0e47f024118fa9f132d307dcfc75d4.tar.gz bcm5719-llvm-a723ba97db0e47f024118fa9f132d307dcfc75d4.zip |
Fix a regression in a previous patch that broke implicit
int in a bitfield. Shantonu found this in a gcc testsuite file.
llvm-svn: 69074
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 6 | ||||
-rw-r--r-- | clang/test/Sema/implicit-int.c | 8 |
2 files changed, 12 insertions, 2 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 1fe0d93d1c0..a4168382509 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -440,7 +440,8 @@ void Parser::ParseSpecifierQualifierList(DeclSpec &DS) { // Validate declspec for type-name. unsigned Specs = DS.getParsedSpecifiers(); - if (Specs == DeclSpec::PQ_None && !DS.getNumProtocolQualifiers()) + if (Specs == DeclSpec::PQ_None && !DS.getNumProtocolQualifiers() && + !DS.getAttributes()) Diag(Tok, diag::err_typename_requires_specqual); // Issue diagnostic and remove storage class if present. @@ -475,6 +476,7 @@ void Parser::ParseSpecifierQualifierList(DeclSpec &DS) { /// int x = 17; // init-declarator-list /// int x , y; // init-declarator-list /// int x __asm__ ("foo"); // init-declarator-list +/// int x : 4; // struct-declarator /// int x { 5}; // C++'0x unified initializers /// /// This is not, because 'x' does not immediately follow the declspec (though @@ -484,7 +486,7 @@ void Parser::ParseSpecifierQualifierList(DeclSpec &DS) { static bool isValidAfterIdentifierInDeclarator(const Token &T) { return T.is(tok::l_square) || T.is(tok::l_paren) || T.is(tok::r_paren) || T.is(tok::semi) || T.is(tok::comma) || T.is(tok::equal) || - T.is(tok::kw_asm) || T.is(tok::l_brace); + T.is(tok::kw_asm) || T.is(tok::l_brace) || T.is(tok::colon); } /// ParseDeclarationSpecifiers diff --git a/clang/test/Sema/implicit-int.c b/clang/test/Sema/implicit-int.c index 71a5724a1ff..90fe607e120 100644 --- a/clang/test/Sema/implicit-int.c +++ b/clang/test/Sema/implicit-int.c @@ -22,3 +22,11 @@ h19_insline(n) // expected-warning {{parameter 'n' was not declared, defaulting ILPAD(); // expected-warning {{type specifier missing, defaults to 'int'}} } +struct foo { + __extension__ __attribute__((packed)) // expected-warning {{type specifier missing, defaults to 'int'}} + x : 4; +}; + + + + |