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/2] 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/2] 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 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
