[libcxx-commits] [libcxx] [libc++][array] Applied `[[nodiscard]]` (PR #168829)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Nov 21 03:38:13 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{};
----------------
philnik777 wrote:
I was more thinking that we'd only template on the size of the array. That's a bit more verbose, but I think that's be the most readable/obvious version of what's happening.
https://github.com/llvm/llvm-project/pull/168829
More information about the libcxx-commits
mailing list