[clang] [Clang] [C++26] Implement P2573R2: `= delete("should have a reason");` (PR #86526)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 10 10:20:56 PDT 2024


================
@@ -70,8 +108,14 @@ NamedDecl *Parser::ParseCXXInlineMethodDef(
                       ? diag::warn_cxx98_compat_defaulted_deleted_function
                       : diag::ext_defaulted_deleted_function)
         << 1 /* deleted */;
-      Actions.SetDeclDeleted(FnD, KWLoc);
+      StringLiteral *Message = ParseCXXDeletedFunctionMessage();
+      Actions.SetDeclDeleted(FnD, KWLoc, Message);
       Delete = true;
+      if (Message)
+        Diag(Message->getBeginLoc(), getLangOpts().CPlusPlus26
----------------
AaronBallman wrote:

I think should be implemented within `ParseCXXDeletedFunctionMessage()` so anyone calling it gets the diagnostic.

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


More information about the cfe-commits mailing list