[libcxx-commits] [libcxx] [libc++] Applied `[[nodiscard]]` to `array::iterator` (PR #198492)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Tue May 26 07:19:13 PDT 2026
================
@@ -0,0 +1,72 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// Check that functions are marked [[nodiscard]]
+
+#include <array>
+
+#include "test_macros.h"
+
+void test() {
+ typedef std::array<int, 94> Container;
+ Container c;
+ Container::iterator it = c.begin();
+
+#if defined(_LIBCPP_ABI_BOUNDED_ITERATORS_IN_STD_ARRAY)
+ ASSERT_SAME_TYPE(Container::iterator, std::__static_bounded_iter<int*, 94>);
+#elif defined(_LIBCPP_ABI_USE_WRAP_ITER_IN_STD_ARRAY)
+ ASSERT_SAME_TYPE(Container::iterator, std::__wrap_iter<int*>);
+#else
+ ASSERT_SAME_TYPE(Container::iterator, int*);
+#endif
----------------
philnik777 wrote:
What are these useful for?
https://github.com/llvm/llvm-project/pull/198492
More information about the libcxx-commits
mailing list