diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 112184d87d92f3fc5bfc68122b5a8a47b3240e0b..136162ad0fabf730fadab7c23b8c9a27adaaf26e 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -5087,7 +5087,7 @@ static bool hasSimilarParameters(ASTContext &Context, QualType DefParamTy = Definition->getParamDecl(Idx)->getType(); // The parameter types are identical - if (Context.hasSameType(DefParamTy, DeclParamTy)) + if (Context.hasSameUnqualifiedType(DefParamTy, DeclParamTy)) continue; QualType DeclParamBaseTy = getCoreType(DeclParamTy); diff --git a/clang/test/SemaCXX/function-redecl.cpp b/clang/test/SemaCXX/function-redecl.cpp index f91e670c0c31c50a81ed958ef9aae28afeeb4ca8..34d2acc75430c3b1753039aafe98d5a6886d6244 100644 --- a/clang/test/SemaCXX/function-redecl.cpp +++ b/clang/test/SemaCXX/function-redecl.cpp @@ -125,3 +125,9 @@ bool Foo::isGood() { // expected-error {{out-of-line definition of 'isGood' does } void Foo::beEvil() {} // expected-error {{out-of-line definition of 'beEvil' does not match any declaration in namespace 'redecl_typo::Foo'; did you mean 'BeEvil'?}} } + +struct CVQualFun { + void func(int a, int &b); // expected-note {{type of 2nd parameter of member declaration does not match definition ('int &' vs 'int')}} +}; + +void CVQualFun::func(const int a, int b) {} // expected-error {{out-of-line definition of 'func' does not match any declaration in 'CVQualFun'}}