[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:57 PDT 2024


================
@@ -1415,6 +1416,12 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D,
                       : diag::ext_defaulted_deleted_function)
           << 1 /* deleted */;
       BodyKind = Sema::FnBodyKind::Delete;
+      DeletedMessage = ParseCXXDeletedFunctionMessage();
+      if (DeletedMessage)
+        Diag(DeletedMessage->getBeginLoc(),
+             getLangOpts().CPlusPlus26 ? diag::warn_cxx23_delete_with_message
+                                       : diag::ext_delete_with_message)
+            << DeletedMessage->getSourceRange();
----------------
AaronBallman wrote:

This code can be removed once the diagnostic is hoisted into the helper method.

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


More information about the cfe-commits mailing list