https://github.com/localspook updated 
https://github.com/llvm/llvm-project/pull/195192

>From a4e83e81319e5214f6c40ea83d9c8c168f93062f Mon Sep 17 00:00:00 2001
From: Victor Chernyakin <[email protected]>
Date: Thu, 30 Apr 2026 15:32:42 -0700
Subject: [PATCH 1/3] Mark CWG2943 as implemented and add a test

---
 clang/test/CXX/drs/cwg29xx.cpp | 17 +++++++++++++++++
 clang/www/cxx_dr_status.html   |  2 +-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/clang/test/CXX/drs/cwg29xx.cpp b/clang/test/CXX/drs/cwg29xx.cpp
index 54f5547a1629d..4aa5c4d46ab43 100644
--- a/clang/test/CXX/drs/cwg29xx.cpp
+++ b/clang/test/CXX/drs/cwg29xx.cpp
@@ -174,4 +174,21 @@ constexpr U _ = nondeterministic(true);
 #endif
 } // namespace cwg2922
 
+namespace cwg2943 { // cwg2943: 3.9
+#if __cplusplus >= 201703L
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wignored-attributes"
+[[nodiscard]] void f();
+#pragma clang diagnostic pop
+template <class T> [[nodiscard]] T g();
+
+void h() {
+  f();
+  g<void>();
+  g<int>();
+  // expected-warning@-1 {{ignoring return value of function declared with 
'nodiscard' attribute}}
+}
+#endif
+} // namespace cwg2943
+
 // cwg2947 is in cwg2947.cpp
diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index 51c3d87322d0a..83689e744658e 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -20418,7 +20418,7 @@ <h2 id="cxxdr">C++ defect report implementation 
status</h2>
     <td>[<a 
href="https://wg21.link/dcl.attr.nodiscard";>dcl.attr.nodiscard</a>]</td>
     <td>CD7</td>
     <td>Discarding a void return value</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Clang 3.9</td>
   </tr>
   <tr id="2944">
     <td><a 
href="https://cplusplus.github.io/CWG/issues/2944.html";>2944</a></td>

>From ea45ad95c2fb0d86f6dae6c75d3dc9815952f6e4 Mon Sep 17 00:00:00 2001
From: Victor Chernyakin <[email protected]>
Date: Wed, 6 May 2026 12:45:50 -0700
Subject: [PATCH 2/3] Add more test cases from the example in the standard

---
 clang/test/CXX/drs/cwg29xx.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/test/CXX/drs/cwg29xx.cpp b/clang/test/CXX/drs/cwg29xx.cpp
index 4aa5c4d46ab43..4731bc74306f6 100644
--- a/clang/test/CXX/drs/cwg29xx.cpp
+++ b/clang/test/CXX/drs/cwg29xx.cpp
@@ -184,9 +184,11 @@ template <class T> [[nodiscard]] T g();
 
 void h() {
   f();
-  g<void>();
+  (void)f();
   g<int>();
   // expected-warning@-1 {{ignoring return value of function declared with 
'nodiscard' attribute}}
+  g<void>();
+  (void)g<void>();
 }
 #endif
 } // namespace cwg2943

>From 7b584f0021eb37272e39b21c8a474ec5bf86e84a Mon Sep 17 00:00:00 2001
From: Victor Chernyakin <[email protected]>
Date: Thu, 7 May 2026 10:15:00 -0700
Subject: [PATCH 3/3] Replace pragmas

---
 clang/test/CXX/drs/cwg29xx.cpp | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/clang/test/CXX/drs/cwg29xx.cpp b/clang/test/CXX/drs/cwg29xx.cpp
index 4731bc74306f6..4b57fa35f33c0 100644
--- a/clang/test/CXX/drs/cwg29xx.cpp
+++ b/clang/test/CXX/drs/cwg29xx.cpp
@@ -176,10 +176,8 @@ constexpr U _ = nondeterministic(true);
 
 namespace cwg2943 { // cwg2943: 3.9
 #if __cplusplus >= 201703L
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wignored-attributes"
 [[nodiscard]] void f();
-#pragma clang diagnostic pop
+// expected-warning@-1 {{attribute 'nodiscard' cannot be applied to functions 
without return value}}
 template <class T> [[nodiscard]] T g();
 
 void h() {

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to