Nvc++ compilation fails with execution policy change

The code below compiles with execution of seq, but not par:
//Parallel brute-force finding of near-neighbors of x in y;
auto search_with_copy_if(vector &x, vector &y) {
vector<std::tuple<size_t, size_t>> nn_pairs( //Allocate 1D array of pairs:
10 * x.size(),
std::tuple<size_t, size_t>{-9999, -9999});
auto xs = std::views::iota((size_t)0, x.size());
auto ys = std::views::iota((size_t)0, y.size());
auto ids = std::views::cartesian_product(xs, ys);
//copy a touple [i,j] from ids into nn_pairs if x[i] near j[j]
std::execution::par, //nvc++ for gpu compiles with seq, but not with par
ids.begin(), ids.end(),
nn_pairs.begin(), //GPU nvc++ requires random_access iter;
[=, x = x.data(), y = y.data()](auto idx) {
auto i = get<0>(idx);
auto j = get<1>(idx);
return is_near(x[i], y[j]); //is_near returns true iff x[i]=y[i] ± delta.
return nn_pairs;

I am using nvc++ 23.5 with flags -std=c++20 -stdpar=gpu -O2 -g. The two error messages are:

[build] /opt/nvidia/hpc_sdk/Linux_x86_64/23.5/compilers/share/llvm/bin/opt: /tmp/nvc++5-XkRAsqATbA.ll:286988:1: error: redefinition of global ‘@_ZN70_INTERNAL_48__home_mzuniga_gfdl_misc_src_cpp_src_stdpartest_C_02339522St14is_reference_vIRKDTcl6deduceIN2tl22cartesian_product_viewIJNSt6ranges9iota_viewImmEES4_EE6cursorILb0EEEELi0EEEEE’

[build] @_ZN70_INTERNAL_48__home_mzuniga_gfdl_misc_src_cpp_src_stdpartest_C_02339522St14is_reference_vIRKDTcl6deduceIN2tl22cartesian_product_viewIJNSt6ranges9iota_viewImmEES4_EE6cursorILb0EEEELi0EEEEE = internal dso_local global i8 1, align 1, !dbg !156711


I see different behavior than you do. Can you tell us what version of gcc/gnu headers you are using? I suspect it might have something to do with the support of cartesion_product, but let me get a reproducer here first.

Thanks for looking at this. I am using ubuntu 23.04 with gcc 12.3. Under /usr/include/c++ and also under /usr/include/x86_64-linux-gnu/c++ I see directories 11 and 12. A while ago I did have gcc 13 and removed it with apt.
I also tried compiling with nvc++ 23.7 and its the same result. I made a mini camke+c++ project in clion which can put on github or send as tar file if you wish. That would have the implementation of cartesian_product.hpp (which I got from an nvidia course I took early this year). Also, do you know if there is a way to see all the header files that nvc++ is seeing or using at compile ? I am thinking it is possible I have a stray header from my computers C++ 13 era. Thanks

I will find a gcc 12.x machine today and try this. FYI, compiling with -E will perform all the preprocessing, and save the results to stdout, where you can see all the headers pulled in.
Oh, and include for me how you are defining vector, to make sure I am doing that the same way.