diff options
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 3 | ||||
| -rw-r--r-- | clang/test/SemaCXX/function-redecl.cpp | 4 | 
2 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 898fca4203d..106363f6d73 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -4235,7 +4235,8 @@ static void DiagnoseInvalidRedeclaration(Sema &S, FunctionDecl *NewFD,      }    // If the qualified name lookup yielded nothing, try typo correction    } else if ((Correction = S.CorrectTypo(Prev.getLookupNameInfo(), -                                         Prev.getLookupKind(), 0, 0, DC))) { +                                         Prev.getLookupKind(), 0, 0, DC)) && +             Correction.getCorrection() != Name) {      DiagMsg = isFriendDecl ? diag::err_no_matching_local_friend_suggest                             : diag::err_member_def_does_not_match_suggest;      for (TypoCorrection::decl_iterator CDecl = Correction.begin(), diff --git a/clang/test/SemaCXX/function-redecl.cpp b/clang/test/SemaCXX/function-redecl.cpp index 8c734945f25..2ea407cdf5e 100644 --- a/clang/test/SemaCXX/function-redecl.cpp +++ b/clang/test/SemaCXX/function-redecl.cpp @@ -50,3 +50,7 @@ class B {  void B::Notypocorrection(int) { // expected-error {{out-of-line definition of 'Notypocorrection' does not match any declaration in 'B'; did you mean 'typocorrection'}}  } + +struct X { int f(); }; +struct Y : public X {}; +int Y::f() { return 3; } // expected-error {{out-of-line definition of 'f' does not match any declaration in 'Y'}}  | 

