From a89ee579e86912302251dd9b06a472b4531f864f Mon Sep 17 00:00:00 2001 From: Kaelyn Uhrain Date: Tue, 1 Oct 2013 22:00:28 +0000 Subject: [PATCH] Fix a typo suggestion regression introduced by r191544. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191798 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Parse/ParseStmt.cpp | 2 +- test/SemaCXX/typo-correction-pt2.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index 28580ab2bb..ef1ab89b8c 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -129,7 +129,7 @@ public: virtual bool ValidateCandidate(const TypoCorrection &candidate) { if (FieldDecl *FD = candidate.getCorrectionDeclAs()) - return isa(FD); + return !candidate.getCorrectionSpecifier() || isa(FD); if (NextToken.is(tok::equal)) return candidate.getCorrectionDeclAs(); if (NextToken.is(tok::period) && diff --git a/test/SemaCXX/typo-correction-pt2.cpp b/test/SemaCXX/typo-correction-pt2.cpp index 9c7fb14ccf..f360649ccc 100644 --- a/test/SemaCXX/typo-correction-pt2.cpp +++ b/test/SemaCXX/typo-correction-pt2.cpp @@ -144,3 +144,10 @@ namespace PR17394 { class B : private A {}; B zzzzzzzzzy<>; // expected-error {{expected ';' after top level declarator}}{} } + +namespace correct_fields_in_member_funcs { +struct S { + int my_member; // expected-note {{'my_member' declared here}} + void f() { my_menber = 1; } // expected-error {{use of undeclared identifier 'my_menber'; did you mean 'my_member'?}} +}; +} -- 2.40.0