[PATCH] D57032: [SemaCXX] Param diagnostic matches overload logic
Brian Gesiak via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 30 06:35:58 PST 2019
modocache updated this revision to Diff 184284.
modocache added a comment.
Thanks, @cpplearner! You're absolutely right. I got confused because I didn't realize that the method `FunctionProtoType::getUnqualifiedType` was being used from within `Sema::FunctionParamTypesAreEqual`, not `QualType::getUnqualifiedType`. I modified my patch to use `ASTContext::hasSameUnqualifiedType` instead.
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57032/new/
https://reviews.llvm.org/D57032
Files:
lib/Sema/SemaDecl.cpp
test/SemaCXX/function-redecl.cpp
Index: test/SemaCXX/function-redecl.cpp
===================================================================
--- test/SemaCXX/function-redecl.cpp
+++ test/SemaCXX/function-redecl.cpp
@@ -125,3 +125,9 @@
}
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'}}
Index: lib/Sema/SemaDecl.cpp
===================================================================
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -5087,7 +5087,7 @@
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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57032.184284.patch
Type: text/x-patch
Size: 1170 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190130/7d3276ad/attachment-0001.bin>
More information about the cfe-commits
mailing list