[libcxx-commits] [libcxx] [libc++][array] Applied `[[nodiscard]]` (PR #168829)

Hristo Hristov via libcxx-commits libcxx-commits at lists.llvm.org
Fri Nov 21 05:08:35 PST 2025


================
@@ -11,13 +11,61 @@
 // check that <array> functions are marked [[nodiscard]]
 
 #include <array>
+#include <utility>
 
-void array_test() {
-  std::array<int, 1> array;
-  array.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+#include <test_macros.h>
+
+template <typename ArrT>
+void test_members() {
+  ArrT a{};
----------------
Zingam wrote:

I did that as the first iteration the I noticed this pattern in vector.nodiscard.

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


More information about the libcxx-commits mailing list