> Fixing this case is a bit trickier because declspec is parsed with colon > protection turned off, otherwise we cannot recover typos like: > > A:B c;
With your patch, it's parsed with colon protection turned on, right? Or do we also need to add colon protection to tentative parsing of member-declarations? If you want to detect and recover from the above case, you need more lookahead than you're currently using: you need to check if the colon is followed by *two* identifiers. If it is, you can temporarily turn off colon protection. ================ Comment at: lib/Parse/Parser.cpp:1692-1694 @@ +1691,5 @@ +/// +/// Setting NeedType influences error recovery. If it is set, parser avoids +/// replacements ':' -> '::' if it produces non-type entity. With it we can +/// parse correctly code like this: +/// \code ---------------- This doesn't seem correct. Even if `A::B::C` is a type, we still should not do the recovery here, because this may still be an unnamed bitfield. Also, I'm concerned about whether this `NeedType` thing is correct, since we use `TryAnnotateCXXScopeSpec` from tentative parsing when we don't know whether we expect a type or not. http://reviews.llvm.org/D3653 _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
