[clang] [RFC] Initial implementation of P2719 (PR #113510)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 7 00:20:45 PST 2025
================
@@ -2533,11 +2533,34 @@ bool CXXMethodDecl::isUsualDeallocationFunction(
getOverloadedOperator() != OO_Array_Delete)
return false;
+ bool IsTypeAware = isTypeAwareOperatorNewOrDelete();
+
// C++ [basic.stc.dynamic.deallocation]p2:
+ // Pre-type aware allocators:
// A template instance is never a usual deallocation function,
// regardless of its signature.
- if (getPrimaryTemplate())
- return false;
+ // Pending final C++26 text:
+ // A template instance is only a usual deallocation function if it
+ // is a type aware deallocation function, and only the type-identity
+ // parameter is dependent.
+ if (FunctionTemplateDecl *PrimaryTemplate = getPrimaryTemplate()) {
+ if (!IsTypeAware) {
+ // Stop early on if the specialization is not explicitly type aware
+ return false;
+ }
----------------
cor3ntin wrote:
```suggestion
if (!IsTypeAware)
// Stop early on if the specialization is not explicitly type aware
return false;
```
https://github.com/llvm/llvm-project/pull/113510
More information about the cfe-commits
mailing list