[clang] [clang][NFC] Mark CWG2943 as implemented and add a test (PR #195192)
Victor Chernyakin via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 30 16:06:58 PDT 2026
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 <chernyakin.victor.j at outlook.com>
Date: Thu, 30 Apr 2026 15:32:42 -0700
Subject: [PATCH] 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 at -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>
More information about the cfe-commits
mailing list