[libcxx-commits] [libcxx] [libc++][array] Applied `[[nodiscard]]` (PR #168829)
Hristo Hristov via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Nov 20 04:15:57 PST 2025
================
@@ -11,13 +11,96 @@
// check that <array> functions are marked [[nodiscard]]
#include <array>
+#include <utility>
+
+#include <test_macros.h>
void array_test() {
- std::array<int, 1> array;
- array.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::array<int, 1> a;
+ const std::array<int, 1> ca{9482};
+
+ a.begin(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
----------------
Zingam wrote:
I'm fine with that. I thought we should write everything explicitly.
https://github.com/llvm/llvm-project/pull/168829
More information about the libcxx-commits
mailing list