[clang] [Clang] fix overload resolution for object parameters with top-level cv-qualifiers in member functions (PR #110435)

via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 11 10:32:14 PDT 2024


================
@@ -1422,8 +1422,14 @@ static bool IsOverloadOrOverrideImpl(Sema &SemaRef, FunctionDecl *New,
   // the implicit object parameter are of the same type.
 
   auto NormalizeQualifiers = [&](const CXXMethodDecl *M, Qualifiers Q) {
-    if (M->isExplicitObjectMemberFunction())
+    if (M->isExplicitObjectMemberFunction()) {
+      if (M->getNumParams() > 0) {
+        auto ThisType = M->getParamDecl(0)->getType().getCanonicalType();
----------------
cor3ntin wrote:

```suggestion
        auto ThisType = M->getFunctionObjectParameterReferenceType().getCanonicalType();
```

Do we actually need to call `getCanonicalType()`?

https://github.com/llvm/llvm-project/pull/110435


More information about the cfe-commits mailing list