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

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 7 06:23:28 PDT 2024


================
@@ -1511,8 +1511,11 @@ static bool IsOverloadOrOverrideImpl(Sema &SemaRef, FunctionDecl *New,
       auto NewObjectType = New->getFunctionObjectParameterReferenceType();
       auto OldObjectType = Old->getFunctionObjectParameterReferenceType();
 
-      if (NewObjectType.isConstQualified() != OldObjectType.isConstQualified())
-        return false;
+      if (Old->isExplicitObjectMemberFunction() &&
+          OldObjectType.getQualifiers() != NewObjectType.getQualifiers())
----------------
erichkeane wrote:

The always-early-return doesn't make sense here to me, as Corentin mentioned, because `__restrict` can't be overloaded on IIRC.

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


More information about the cfe-commits mailing list