On 20/11/2020 23:44, Thomas Rodgers wrote:
Tested x86_64-pc-linux-gnu, committed.

Clang complains:

$ cat test.cc
#include <semaphore>

$ clang++ --gcc-toolchain=~/gcc/trunk/inst -std=c++20 -fsyntax-only test.cc
In file included from test.cc:1:
In file included from 
~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../include/c++/11.0.0/semaphore:36:
~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../include/c++/11.0.0/bits/semaphore_base.h:145:22:
 error: no viable conversion from 'std::chrono::system_clock::time_point' (aka 
'time_point<std::chrono::system_clock, duration<long, ratio<1, 1000000000>>>') 
to 'const std::__platform_semaphore::__clock_t' (aka 'const std::chrono::system_clock')
            const __clock_t __s_entry = __clock_t::now();
                            ^           ~~~~~~~~~~~~~~~~
~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../include/c++/11.0.0/chrono:1101:12: 
note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 
'std::chrono::system_clock::time_point' (aka 'time_point<std::chrono::system_clock, 
duration<long, ratio<1, 1000000000>>>') to 'const std::chrono::system_clock &' for 
1st argument
    struct system_clock
           ^
~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../include/c++/11.0.0/chrono:1101:12: note: 
candidate constructor (the implicit move constructor) not viable: no known conversion from 
'std::chrono::system_clock::time_point' (aka 'time_point<std::chrono::system_clock, duration<long, 
ratio<1, 1000000000>>>') to 'std::chrono::system_clock &&' for 1st argument
1 error generated.

which

diff --git a/libstdc++-v3/include/bits/semaphore_base.h 
b/libstdc++-v3/include/bits/semaphore_base.h
index 78a0b6ba26e..f25c9fdb325 100644
--- a/libstdc++-v3/include/bits/semaphore_base.h
+++ b/libstdc++-v3/include/bits/semaphore_base.h
@@ -142,7 +142,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        else
          {
            const typename _Clock::time_point __c_entry = _Clock::now();
-           const __clock_t __s_entry = __clock_t::now();
+           const __clock_t::time_point __s_entry = __clock_t::now();
            const auto __delta = __atime - __c_entry;
            const auto __s_atime = __s_entry + __delta;
            if (_M_try_acquire_until_impl(__s_atime))
~

would fix.

Reply via email to