diff options
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Sema/SemaLookup.cpp | 2 | ||||
| -rw-r--r-- | clang/test/SemaCXX/typo-correction-pt2.cpp | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 39dd555aeae..8a5c0a5ba7e 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -4216,7 +4216,7 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName, if (CXXRecordDecl *CD = (*TI)->getAsCXXRecordDecl()) { CD = CD->getCanonicalDecl(); if (!CD->isDependentType() && !CD->isAnonymousStructOrUnion() && - !CD->isUnion() && + !CD->isUnion() && CD->getIdentifier() && (CD->isBeingDefined() || CD->isCompleteDefinition())) Namespaces.AddNameSpecifier(CD); } diff --git a/clang/test/SemaCXX/typo-correction-pt2.cpp b/clang/test/SemaCXX/typo-correction-pt2.cpp index 78951004901..65d961085a8 100644 --- a/clang/test/SemaCXX/typo-correction-pt2.cpp +++ b/clang/test/SemaCXX/typo-correction-pt2.cpp @@ -199,3 +199,11 @@ template <> PR18213::WrapperInfo ::PR18213::Wrappable<int>::kWrapperInfo = { 0 }; // expected-error {{no member named 'PR18213' in 'PR18213::WrapperInfo'; did you mean simply 'PR18213'?}} \ // expected-error {{C++ requires a type specifier for all declarations}} } + +namespace PR18651 { +struct { + int x; +} a, b; + +int y = x; // expected-error-re {{use of undeclared identifier 'x'{{$}}}} +} |

