[clang] [RFC] Initial implementation of P2719 (PR #113510)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 1 07:07:44 PDT 2024


================
@@ -1847,15 +1909,41 @@ static bool hasNewExtendedAlignment(Sema &S, QualType AllocType) {
              S.getASTContext().getTargetInfo().getNewAlign();
 }
 
+static bool CheckDeleteOperator(Sema &S, SourceLocation StartLoc,
+                                SourceRange Range, bool Diagnose,
+                                CXXRecordDecl *NamingClass, DeclAccessPair Decl,
+                                FunctionDecl *Operator) {
+  if (S.IsTypeAwareOperatorNewOrDelete(Operator)) {
+    auto SelectedTypeIdentityParameter = Operator->getParamDecl(0)->getType();
+    if (S.RequireCompleteType(StartLoc, SelectedTypeIdentityParameter,
+                              diag::err_incomplete_type))
+      return true;
+  }
+
+  // FIXME: DiagnoseUseOfDecl?
----------------
AaronBallman wrote:

That does seem like a better approach because that also catches things like availability attributes, deprecation, etc.

https://github.com/llvm/llvm-project/pull/113510


More information about the cfe-commits mailing list