================ @@ -16421,33 +16715,70 @@ CheckOperatorDeleteDeclaration(Sema &SemaRef, FunctionDecl *FnDecl) { return true; auto *MD = dyn_cast<CXXMethodDecl>(FnDecl); + auto ConstructDestroyingDeleteAddressType = [&]() { + assert(MD); + return SemaRef.Context.getCanonicalType(SemaRef.Context.getPointerType( + SemaRef.Context.getRecordType(MD->getParent()))); + }; + + // C++ P2719: A destroying operator delete cannot be type aware + // so for QoL we actually check for this explicitly by considering + // an destroying-delete appropriate address type and the presence of + // any parameter of type destroying_delete_t as an erroneous attempt + // to declare a type aware destroying delete, rather than emitting a + // pile of incorrect parameter type errors. + if (MD && IsPotentiallyTypeAwareOperatorNewOrDelete( + SemaRef, MD, /*WasMalformed=*/nullptr)) { + QualType AddressParamType = + SemaRef.Context.getCanonicalType(MD->getParamDecl(1)->getType()); + if (AddressParamType != SemaRef.Context.VoidPtrTy && ---------------- cor3ntin wrote:
I think you are trying too hard. We should not have any sympathy for people using `std::destroying_delete_t` outside of its intended purpose. So, looking at the class type is just extra work that we don't need. It also doesn't make sense to look past the... 3rd parameter imo. https://github.com/llvm/llvm-project/pull/113510 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits