[cfe-commits] r137987 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/SemaCXX/function-redecl.cpp
Kaelyn Uhrain
rikka at google.com
Thu Aug 18 14:57:36 PDT 2011
Author: rikka
Date: Thu Aug 18 16:57:36 2011
New Revision: 137987
URL: http://llvm.org/viewvc/llvm-project?rev=137987&view=rev
Log:
Don't accept a typo correction if the corrected identifier is the same as the
uncorrected identifier. Fixes a problem pointed out by Eli.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaCXX/function-redecl.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=137987&r1=137986&r2=137987&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Aug 18 16:57:36 2011
@@ -4235,7 +4235,8 @@
}
// 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(),
Modified: cfe/trunk/test/SemaCXX/function-redecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/function-redecl.cpp?rev=137987&r1=137986&r2=137987&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/function-redecl.cpp (original)
+++ cfe/trunk/test/SemaCXX/function-redecl.cpp Thu Aug 18 16:57:36 2011
@@ -50,3 +50,7 @@
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'}}
More information about the cfe-commits
mailing list