================
@@ -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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to