Specifically, avoid typo-correcting the variable name into a type before
typo-correcting the actual type name in the declaration. Doing so
results in a very unpleasant cascade of errors, with the typo correction
of the actual type name being buried in the middle.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219732
91177308-0d34-0410-b5e6-
96231b3b80d8
// to types and identifiers, in order to try to recover from errors.
CorrectionCandidateCallback TypoCorrection;
TypoCorrection.WantRemainingKeywords = false;
- TypoCorrection.WantTypeSpecifiers = Next.isNot(tok::arrow);
+ TypoCorrection.WantTypeSpecifiers =
+ Next.is(tok::l_paren) || Next.is(tok::r_paren) ||
+ Next.is(tok::greater) || Next.is(tok::l_brace) ||
+ Next.is(tok::identifier);
switch (TryAnnotateName(false /* no nested name specifier */,
&TypoCorrection)) {
case ANK_Error:
return lon(8.0); // expected-error {{use of undeclared identifier 'lon'; did you mean 'long'?}}
}
}
+
+namespace testCXXDeclarationSpecifierParsing {
+namespace test {
+ struct SomeSettings {}; // expected-note {{'test::SomeSettings' declared here}}
+}
+class Test {};
+int bar() {
+ Test::SomeSettings some_settings; // expected-error {{no type named 'SomeSettings' in 'testCXXDeclarationSpecifierParsing::Test'; did you mean 'test::SomeSettings'?}}
+}
+}