Skip to content

Commit 56381b8

Browse files
author
Matt Beaumont-Gay
committed
Fix an incorrect note.
For the test case added to function-redecl.cpp, we were previously complaining about a mismatch in the parameter types, since the definition used the typedef'd type. llvm-svn: 138318
1 parent 2a3ffb5 commit 56381b8

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

clang/lib/Sema/SemaDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2924,7 +2924,7 @@ static bool isNearlyMatchingFunction(ASTContext &Context,
29242924
QualType DefParamTy = Definition->getParamDecl(Idx)->getType();
29252925

29262926
// The parameter types are identical
2927-
if (DefParamTy == DeclParamTy)
2927+
if (Context.hasSameType(DefParamTy, DeclParamTy))
29282928
continue;
29292929

29302930
QualType DeclParamBaseTy = getCoreType(DeclParamTy);

clang/test/SemaCXX/function-redecl.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,19 @@ void B::Notypocorrection(int) { // expected-error {{out-of-line definition of 'N
5454
struct X { int f(); };
5555
struct Y : public X {};
5656
int Y::f() { return 3; } // expected-error {{out-of-line definition of 'f' does not match any declaration in 'Y'}}
57+
58+
namespace test1 {
59+
struct Foo {
60+
class Inner { };
61+
};
62+
}
63+
64+
class Bar {
65+
void f(test1::Foo::Inner foo) const; // expected-note {{member declaration nearly matches}}
66+
};
67+
68+
using test1::Foo;
69+
70+
void Bar::f(Foo::Inner foo) { // expected-error {{out-of-line definition of 'f' does not match any declaration in 'Bar'}}
71+
(void)foo;
72+
}

0 commit comments

Comments
 (0)