[clang] [RFC] Initial implementation of P2719 (PR #113510)
Oliver Hunt via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 8 15:04:41 PDT 2025
================
@@ -16335,22 +16550,27 @@ CheckOperatorNewDeclaration(Sema &SemaRef, const FunctionDecl *FnDecl) {
CanQualType SizeTy =
SemaRef.Context.getCanonicalType(SemaRef.Context.getSizeType());
+ unsigned MinimumNonDefaultArgs = 0;
// C++ [basic.stc.dynamic.allocation]p1:
// The return type shall be void*. The first parameter shall have type
// std::size_t.
- if (CheckOperatorNewDeleteTypes(SemaRef, FnDecl, SemaRef.Context.VoidPtrTy,
- SizeTy,
+ if (CheckOperatorNewDeleteTypes(SemaRef, FnDecl, AllocationOperatorKind::New,
+ SemaRef.Context.VoidPtrTy, SizeTy,
diag::err_operator_new_dependent_param_type,
- diag::err_operator_new_param_type))
+ diag::err_operator_new_param_type,
+ &MinimumNonDefaultArgs))
return true;
-
+ assert(MinimumNonDefaultArgs > 0 && MinimumNonDefaultArgs <= 4);
// C++ [basic.stc.dynamic.allocation]p1:
// The first parameter shall not have an associated default argument.
- if (FnDecl->getParamDecl(0)->hasDefaultArg())
----------------
ojhunt wrote:
rewrote things
https://github.com/llvm/llvm-project/pull/113510
More information about the cfe-commits
mailing list