-
Notifications
You must be signed in to change notification settings - Fork 14.6k
[Clang] update reasoned delete diagnostic kind to use Extension, making it pedantic only #114713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ng it pedantic only
@llvm/pr-subscribers-clang Author: Oleksandr T. (a-tarasyuk) ChangesFixes #109311 Full diff: https://github.com/llvm/llvm-project/pull/114713.diff 3 Files Affected:
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 1372e49dfac03c..3db2aa472902bc 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -464,6 +464,8 @@ Improvements to Clang's diagnostics
- Clang now diagnoses ``[[deprecated]]`` attribute usage on local variables (#GH90073).
+- Clang now diagnoses misused reasoned ``delete("reason")`` warnings only in pedantic mode. (#GH109311).
+
Improvements to Clang's time-trace
----------------------------------
diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td
index 78510e61a639fa..6fbe874c5e6425 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -971,7 +971,7 @@ def warn_cxx98_compat_defaulted_deleted_function : Warning<
"%select{defaulted|deleted}0 function definitions are incompatible with C++98">,
InGroup<CXX98Compat>, DefaultIgnore;
-def ext_delete_with_message : ExtWarn<
+def ext_delete_with_message : Extension<
"'= delete' with a message is a C++2c extension">, InGroup<CXX26>;
def warn_cxx23_delete_with_message : Warning<
"'= delete' with a message is incompatible with C++ standards before C++2c">,
diff --git a/clang/test/Parser/cxx2c-delete-with-message.cpp b/clang/test/Parser/cxx2c-delete-with-message.cpp
index 1767a080a7dcd8..5796c548632ae4 100644
--- a/clang/test/Parser/cxx2c-delete-with-message.cpp
+++ b/clang/test/Parser/cxx2c-delete-with-message.cpp
@@ -1,7 +1,17 @@
-// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify=expected,pre26 -pedantic %s
+// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify=expected -DTEST_NON_PEDANTIC %s
+// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify=expected,pre26 -pedantic %s
// RUN: %clang_cc1 -std=c++2c -fsyntax-only -verify=expected,compat -Wpre-c++26-compat %s
// RUN: %clang_cc1 -std=c++2c -fsyntax-only -verify %s
+#ifdef DTEST_NON_PEDANTIC
+namespace GH109311 {
+void f() = delete
+#if __cpp_deleted_function >= 202403L
+ ("reason") // ok
+#endif
+;
+}
+#else
struct S {
void a() = delete;
void b() = delete(; // expected-error {{expected string literal}} expected-error {{expected ')'}} expected-note {{to match this '('}}
@@ -49,3 +59,4 @@ struct C {
U f = delete ("hello"); // expected-error {{cannot delete expression of type 'const char[6]'}}
};
}
+#endif
\ No newline at end of file
|
I think we should make these changes to all backported features. |
@zwuis @AaronBallman is it okay to handle that in a separate issue/PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for working on this!
Yeah, I think it's fine to handle separately. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM assuming precommit CI comes back green.
Btw, now would probably be a good time for you to get your own commit privileges, you've done a number of quality contributions already: https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access
Fixes #109311
#109311 (comment)