[libcxx-commits] [libcxx] [libc++] Implement LWG4245: Operators that interact with counted_iterator and default_sentinel_t should be noexcept (PR #235445)

R. Aoto via libcxx-commits libcxx-commits at lists.llvm.org
Sun Oct 25 10:43:56 PDT 2026


================
@@ -77,6 +77,11 @@ constexpr bool test() {
     {
       std::counted_iterator iter(cpp20_input_iterator<int*>(buffer), 8);
 
+      static_assert(noexcept(iter == std::default_sentinel));
----------------
aotodev wrote:

Thanks for the review! I kept the checks next to the existing default_sentinel assertions so the behavior and noexcept checks for the same operators stay together, and the synopsis comment at the top of each file now already carries the noexcept, so a second comment naming the issue would duplicate it.

That said, if you and the maintainers prefer either, it's a quick change!


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


More information about the libcxx-commits mailing list