https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67408

            Bug ID: 67408
           Summary: <mutex> assumes that __gthread_mutex_t
                    and__gthread_recursive_mutex_t are the same types
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sebastian.hu...@embedded-brains.de
  Target Milestone: ---

The problem is in in:

[...]
#if _GTHREAD_USE_MUTEX_TIMEDLOCK
  template<typename _Derived>
    class __timed_mutex_impl
    {
[...]
          auto __mutex = static_cast<_Derived*>(this)->native_handle();
          return !__gthread_mutex_timedlock(__mutex, &__ts);

Here I get this for example:

In file included from
libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_for/1.cc:26:0:
libstdc++-v3/include/mutex: In instantiation of 'bool
std::__timed_mutex_impl<_Derived>::_M_try_lock_until(const
std::chrono::time_point<std::chrono::_V2::system_clock, _Duration>&) [with
_Duration = std::chrono::duration<long long int, std::ratio<1ll, 1000000000ll>
>; _Derived = std::recursive_timed_mutex]':
libstdc++-v3/include/mutex:242:55:   required from 'bool
std::__timed_mutex_impl<_Derived>::_M_try_lock_until(const
std::chrono::time_point<_Clock, _Duration>&) [with _Clock =
std::chrono::_V2::steady_clock; _Duration = std::chrono::duration<long long
int, std::ratio<1ll, 1000000000ll> >; _Derived = std::recursive_timed_mutex]'
libstdc++-v3/include/mutex:217:55:   required from 'bool
std::__timed_mutex_impl<_Derived>::_M_try_lock_for(const
std::chrono::duration<_Rep, _Period>&) [with _Rep = long long int; _Period =
std::ratio<1ll>; _Derived = std::recursive_timed_mutex]'
libstdc++-v3/include/mutex:332:39:   required from 'bool
std::recursive_timed_mutex::try_lock_for(const std::chrono::duration<_Rep1,
_Period1>&) [with _Rep = long long int; _Period = std::ratio<1ll>]'
/home/EB/sebastian_h/archive/gcc-git/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_for/1.cc:39:54:
  required from here
libstdc++-v3/include/mutex:234:37: error: cannot convert
'_Mutex_recursive_Control*' to '__gthread_mutex_t* {aka _Mutex_Control*}' for
argument '1' to 'int __gthread_mutex_timedlock(__gthread_mutex_t*, const
__gthread_time_t*)'
    return !__gthread_mutex_timedlock(__mutex, &__ts);
                                     ^

Reply via email to