[libcxx-commits] [libcxx] [libc++] Applied `[[nodiscard]]` to `__static_bounded_iter` (PR #198492)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Tue May 19 05:39:24 PDT 2026
================
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ABI_BOUNDED_ITERATORS_IN_STD_ARRAY
+
+// <array>
+
+// Check that functions are marked [[nodiscard]]
+
+#include <array>
+
+#include "test_macros.h"
+
+void test() { // __static_bounded_iter
+ typedef std::array<int, 94> Container;
+ ASSERT_SAME_TYPE(Container::iterator, std::__static_bounded_iter<int*, 94>);
----------------
frederick-vs-ja wrote:
If we want to reuse the contents for both `__static_bounded_iter` and `__wrap_iter`, perhaps it's better to remove the `// __static_bounded_iter` comment and use conditional compilation for `ASSERT_SAME_TYPE`.
https://github.com/llvm/llvm-project/pull/198492
More information about the libcxx-commits
mailing list