[libcxx-commits] [libcxx] [libc++][ranges] P3059R2: Making user-defined constructors of view iterators/sentinels private (PR #193891)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 6 19:09:50 PDT 2026


================
@@ -39,10 +39,9 @@ void test() {
 
   // LWG 3568. basic_istream_view needs to initialize value_
   {
-    auto iss = make_string_stream<CharT>("123");
+    auto iss = make_string_stream<CharT>("");
----------------
frederick-vs-ja wrote:

Sorry for having completely overlooked this before.

The changes in this file seem incorrect (discovered by @iskandarem in microsoft/STL#6382). `iss` is made empty after such construction, and the beginning iterator is also a past-of-end iterator, which makes it undefined behavior to dereference that iterator.

It might be still possible to verify LWG3658 by constant evaluation. Also it seems invalid to check that `__value_` is initialized to `0`.

```C++
void test() {
  static auto fn_local_iss            = make_string_stream<CharT>(""); // static is critical here
  [[maybe_unused]] constexpr auto isv = std::views::istream<int>(fn_local_iss);
}
```

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


More information about the libcxx-commits mailing list