================ @@ -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 && ---------------- ojhunt wrote:
I actually only went this route because it was not awfully hard and the improvement in diagnostics seemed worth it, and GCC does diagnose these incorrect definitions consistently (whereas we silently produce incorrect codegen in a bunch of cases :-/ ) 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