Fixing an ambiguity in variadics found by clang.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@123337 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant 2011-01-12 22:56:59 +00:00
parent ac38bae75b
commit 6fd4b669ca

View File

@ -364,9 +364,9 @@ lock(_L0& __l0, _L1& __l1)
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _L0, class _L1, class ..._L2>
template <class _L0, class _L1, class _L2, class ..._L3>
void
__lock_first(int __i, _L0& __l0, _L1& __l1, _L2& ...__l2)
__lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
{
while (true)
{
@ -375,7 +375,7 @@ __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& ...__l2)
case 0:
{
unique_lock<_L0> __u0(__l0);
__i = try_lock(__l1, __l2...);
__i = try_lock(__l1, __l2, __l3...);
if (__i == -1)
{
__u0.release();
@ -388,32 +388,32 @@ __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& ...__l2)
case 1:
{
unique_lock<_L1> __u1(__l1);
__i = try_lock(__l2..., __l0);
__i = try_lock(__l2, __l3..., __l0);
if (__i == -1)
{
__u1.release();
return;
}
}
if (__i == sizeof...(_L2))
if (__i == sizeof...(_L3) + 1)
__i = 0;
else
__i += 2;
sched_yield();
break;
default:
__lock_first(__i - 2, __l2..., __l0, __l1);
__lock_first(__i - 2, __l2, __l3..., __l0, __l1);
return;
}
}
}
template <class _L0, class _L1, class ..._L2>
template <class _L0, class _L1, class _L2, class ..._L3>
inline _LIBCPP_INLINE_VISIBILITY
void
lock(_L0& __l0, _L1& __l1, _L2& ...__l2)
lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
{
__lock_first(0, __l0, __l1, __l2...);
__lock_first(0, __l0, __l1, __l2, __l3...);
}
#endif // _LIBCPP_HAS_NO_VARIADICS