Issue 93180
Summary Invalid iterators for empty std::ranges::join_view
Labels new issue
Assignees
Reporter StailGot
    ```c++
#include <iostream>
#include <ranges>
#include <vector>
 
int main()
{
  const std::array<std::vector<int>, 2> v;
  const auto jv = std::ranges::join_view(v);
  
  if (auto it = std::ranges::find(jv, 5); it != jv.end())
    std::cout << std::distance(jv.begin(), it); // should not enter here

   std::cout << 42 << std::endl;
}

// clang++-18 main.cpp --std=c++20 -stdlib=libc++ && ./a.out - # hangs or crash
// clang++-18 main.cpp --std=c++20 -stdlib=libstdc++ && ./a.out - # Ok with libstdc++ or gcc
```

Code compiled with latest clang 18.1.6 and libc++ hangs or crash with Segmentation fault.

https://godbolt.org/z/hxzP7axWj

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to