[cfe-commits] [libcxx] r123337 - /libcxx/trunk/include/mutex

Douglas Gregor dgregor at apple.com
Wed Jan 12 15:04:01 PST 2011


On Jan 12, 2011, at 2:56 PM, Howard Hinnant wrote:

> Author: hhinnant
> Date: Wed Jan 12 16:56:59 2011
> New Revision: 123337
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=123337&view=rev
> Log:
> Fixing an ambiguity in variadics found by clang.

For our spectators... GCC allows this code, Clang rejects it as an ambiguity, and it's not clear exactly what's right given core issue 692.

	- Doug

> Modified:
>    libcxx/trunk/include/mutex
> 
> Modified: libcxx/trunk/include/mutex
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/mutex?rev=123337&r1=123336&r2=123337&view=diff
> ==============================================================================
> --- libcxx/trunk/include/mutex (original)
> +++ libcxx/trunk/include/mutex Wed Jan 12 16:56:59 2011
> @@ -364,9 +364,9 @@
> 
> #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 @@
>         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 @@
>         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
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110112/89246224/attachment.html>


More information about the cfe-commits mailing list