https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67408
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Sebastian Huber from comment #4) > Sorry, I should have linked my patch: > > https://gcc.gnu.org/ml/gcc-patches/2015-09/msg00028.html AH yes, that would work too, and doesn't require the compiler to do any overload resolution. N.B. all libstdc++ patches need to be CC'd to the libstdc++ list, I don't read gcc-patches. > I think the your second version doesn't work in case the types are equal, it > looks similar to my first attempt to fix this which didn't work on Linux. It works fine, because the second overload is a worse overload because it requires a conversion to void, so when the types are equal the first overload is lways used. When the types are not equal the first overload is not viable at all for recursive mutexes, so the second is used, and the second argument is cast back to the __gthread_time_t type.