Namespaces
Variants
Views
Actions

Talk:cpp/thread/counting semaphore

From cppreference.com

Hitting "Run" fails to compile. Is it expected to compile?

GCC 10.2 (C++2a) main.cpp:10:6: error: 'binary_semaphore' in namespace 'std' does not name a type; did you mean 'binary_search'?

216.239.44.65 03:36, 2 November 2020 (PST)Don Hatch

Unfortunately GCC up to v.11 has not implemented C++20's semaphores so far. Clang-11 however backed them alright. You may test the example online on wandbox (working example) or on godbolt selecting Clang-head.
So, the example can't be compiled on cppreference right now. We have to wait until the Coliru (on-line compiler service) provides more recent versions of GCC and CLANG. Thank you anyway. Space Mission (talk)
failing to compile never stopped cppreference from demonstrating new features (and sometimes old features that are still unimplemented), if anything it gets more people to bug their compiler vendors --Cubbi (talk) 19:59, 2 November 2020 (PST)