-
//===--- ParseDecl.cpp - Declaration Parsing ------------------------------===//
//
// The LLVM Compiler Infrastructure
/// struct-declarator: declarator
/// struct-declarator: declarator[opt] ':' constant-expression
- if (Tok.isNot(tok::colon))
+ if (Tok.isNot(tok::colon)) {
+ // Don't parse FOO:BAR as if it were a typo for FOO::BAR.
+ ColonProtectionRAIIObject X(*this);
ParseDeclarator(DeclaratorInfo.D);
+ }
if (Tok.is(tok::colon)) {
ConsumeToken();
return ParseCXXClassMemberDeclaration(AS, TemplateInfo);
}
+ // Don't parse FOO:BAR as if it were a typo for FOO::BAR.
+ ColonProtectionRAIIObject X(*this);
+
CXX0XAttributeList AttrList;
// Optional C++0x attribute-specifier
- if (getLang().CPlusPlus0x && isCXX0XAttributeSpecifier()) {
+ if (getLang().CPlusPlus0x && isCXX0XAttributeSpecifier())
AttrList = ParseCXX0XAttributes();
- }
if (Tok.is(tok::kw_using)) {
// FIXME: Check for template aliases
ParsingDeclarator DeclaratorInfo(*this, DS, Declarator::MemberContext);
if (Tok.isNot(tok::colon)) {
+ // Don't parse FOO:BAR as if it were a typo for FOO::BAR.
+ ColonProtectionRAIIObject X(*this);
+
// Parse the first declarator.
ParseDeclarator(DeclaratorInfo);
// Error parsing the declarator?