]> granicus.if.org Git - clang/commitdiff
When adding a NamedDecl to a correction, add the underlying Decl (via
authorKaelyn Uhrain <rikka@google.com>
Mon, 19 Nov 2012 18:49:53 +0000 (18:49 +0000)
committerKaelyn Uhrain <rikka@google.com>
Mon, 19 Nov 2012 18:49:53 +0000 (18:49 +0000)
getUnderlyingDecl()) so that derivatives of
CorrectionCandidateCallback::ValidateCandidate(...) don't have to worry
about being thrown by UsingDecls and such.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168317 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaLookup.cpp
test/SemaCXX/typo-correction.cpp

index f6987e7bfbe048538d1e982d14a532e46e92cf5a..f257a499d4cea48892fa413ce4f9b3cc2c38d1e5 100644 (file)
@@ -4094,7 +4094,7 @@ void TypoCorrection::addCorrectionDecl(NamedDecl *CDecl) {
   if (isKeyword())
     CorrectionDecls.clear();
 
-  CorrectionDecls.push_back(CDecl);
+  CorrectionDecls.push_back(CDecl->getUnderlyingDecl());
 
   if (!CorrectionName)
     CorrectionName = CDecl->getDeclName();
index c21ef51a7da59a26ca8f6ccbc8f590c6fbd79e5c..4a3f0f6b2949907261a0eadf10b2231d63691ba8 100644 (file)
@@ -236,3 +236,17 @@ void test() {
    return status; // expected-error-re{{use of undeclared identifier 'status'$}}
  }
 }
+
+namespace PR13387 {
+struct A {
+  void CreateFoo(float, float); // expected-note {{'CreateFoo' declared here}}
+  void CreateBar(float, float);
+};
+struct B : A {
+  using A::CreateFoo;
+  void CreateFoo(int, int);
+};
+void f(B &x) {
+  x.Createfoo(0,0); // expected-error {{no member named 'Createfoo' in 'PR13387::B'; did you mean 'CreateFoo'?}}
+}
+}