This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/67408] <mutex> assumes that __gthread_mutex_t and__gthread_recursive_mutex_t are the same types
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 01 Sep 2015 15:39:55 +0000
- Subject: [Bug libstdc++/67408] <mutex> assumes that __gthread_mutex_t and__gthread_recursive_mutex_t are the same types
- Auto-submitted: auto-generated
- References: <bug-67408-4 at http dot gcc dot gnu dot org/bugzilla/>
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.