diff options
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
| -rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 16321491ee8..5c4e898bf62 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -994,9 +994,15 @@ bool Parser::MightBeDeclarator(unsigned Context) { case tok::amp: case tok::ampamp: - case tok::colon: // Might be a typo for '::'. return getLang().CPlusPlus; + case tok::l_square: // Might be an attribute on an unnamed bit-field. + return Context == Declarator::MemberContext && getLang().CPlusPlus0x && + NextToken().is(tok::l_square); + + case tok::colon: // Might be a typo for '::' or an unnamed bit-field. + return Context == Declarator::MemberContext || getLang().CPlusPlus; + case tok::identifier: switch (NextToken().getKind()) { case tok::code_completion: @@ -1019,8 +1025,13 @@ bool Parser::MightBeDeclarator(unsigned Context) { case tok::colon: // At namespace scope, 'identifier:' is probably a typo for 'identifier::' - // and in block scope it's probably a label. - return getLang().CPlusPlus && Context == Declarator::FileContext; + // and in block scope it's probably a label. Inside a class definition, + // this is a bit-field. + return Context == Declarator::MemberContext || + (getLang().CPlusPlus && Context == Declarator::FileContext); + + case tok::identifier: // Possible virt-specifier. + return getLang().CPlusPlus0x && isCXX0XVirtSpecifier(NextToken()); default: return false; |

