llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[libcxx] `error: no member named 'par_unseq' in namespace 'std::execution'`

Open AntonRydahl opened this issue 3 years ago • 4 comments

I stumbled upon something strange. If I compile the program

$ cat src/foreach_minimal.cpp                                                                                                                                   
#include <algorithm>
#include <vector>
#include <execution>

void initzero(int& n){n=0;}

int main()
{
    std::vector<int> v(100);
    std::for_each(std::execution::par_unseq,v.begin(), v.end(),initzero);
    return 0;
}

with

$ clang++ -O1 -Wall -std=c++2a -L/dev/shm/rydahl1/LLVM/install/lib/x86_64-unknown-linux-gnu/ -ltbb src/foreach_minimal.cpp -o bin/foreach_minimal

the system version of libc++ on my machine allows me to compile the naive program. If I instead add -stdlib=libc++, I get

error: no member named 'par_unseq' in namespace 'std::execution'
   10 |     std::for_each(std::execution::par_unseq,v.begin(), v.end(),initzero);

I used the commit eb5fe55b810cc186d2ff31b64294b0d666d623da for the installation.

AntonRydahl avatar Aug 30 '23 22:08 AntonRydahl

We haven't implemented the PSRL fully yet, so you have to add -fexperimental-library to your command line.

philnik777 avatar Aug 30 '23 22:08 philnik777

Thank you, @philnik777! It works with -fexperimental-library -Wl,-rpath,install/lib/x86_64-unknown-linux-gnu/. Should I maybe update the libcxx documentation to mention that?

AntonRydahl avatar Aug 30 '23 22:08 AntonRydahl

There is https://libcxx.llvm.org/UsingLibcxx.html#enabling-experimental-c-library-features. I guess we could list what is currently experimental.

philnik777 avatar Aug 30 '23 22:08 philnik777

There is https://libcxx.llvm.org/UsingLibcxx.html#enabling-experimental-c-library-features. I guess we could list what is currently experimental.

Not Found
The requested URL /UsingLibcxx.html was not found on this server.

Apache/2.4.7 (Ubuntu) Server at libcxx.llvm.org Port 443

Challanger524 avatar Aug 06 '25 10:08 Challanger524