[flang] [clang] [lld] [mlir] [compiler-rt] [libcxxabi] [libcxx] [clang-tools-extra] [lldb] [libunwind] [libc] [llvm] [openmp] [clang] static operators should evaluate object argument (PR #68485)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 11 21:49:18 PST 2024


================
@@ -5678,10 +5678,15 @@ static ImplicitConversionSequence TryObjectArgumentInitialization(
   assert(FromType->isRecordType());
 
   QualType ClassType = S.Context.getTypeDeclType(ActingContext);
-  // [class.dtor]p2: A destructor can be invoked for a const, volatile or
-  //                 const volatile object.
+  // C++98 [class.dtor]p2:
+  //   A destructor can be invoked for a const, volatile or const volatile
+  //   object.
+  // C++98 [over.match.funcs]p4:
+  //   For static member functions, the implicit object parameter is considered
+  //   to match any object (since if the function is selected, the object is
+  //   discarded).
   Qualifiers Quals = Method->getMethodQualifiers();
-  if (isa<CXXDestructorDecl>(Method)) {
+  if (isa<CXXDestructorDecl>(Method) || Method->isStatic()) {
----------------
shafik wrote:

Does this change have a functional change wrt this change or is this just a correctness fix?

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


More information about the cfe-commits mailing list