[libcxx] r203443 - Fix bug I introduced (enabling implicit conversions from compare function to map) in r202994. Thanks to Sebastian Redl for the catch.

Richard Smith richard at metafoo.co.uk
Tue Apr 15 13:03:59 PDT 2014


On Sun, Mar 9, 2014 at 9:50 PM, Marshall Clow <mclow.lists at gmail.com> wrote:

> Author: marshall
> Date: Sun Mar  9 23:50:10 2014
> New Revision: 203443
>
> URL: http://llvm.org/viewvc/llvm-project?rev=203443&view=rev
> Log:
> Fix bug I introduced (enabling implicit conversions from compare function
> to map) in r202994. Thanks to Sebastian Redl for the catch.
>
> Modified:
>     libcxx/trunk/include/map
>     libcxx/trunk/include/set
>
> Modified: libcxx/trunk/include/map
> URL:
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/map?rev=203443&r1=203442&r2=203443&view=diff
>
> ==============================================================================
> --- libcxx/trunk/include/map (original)
> +++ libcxx/trunk/include/map Sun Mar  9 23:50:10 2014
> @@ -835,7 +835,15 @@ public:
>      typedef _VSTD::reverse_iterator<const_iterator>
> const_reverse_iterator;
>
>      _LIBCPP_INLINE_VISIBILITY
> -    map(const key_compare& __comp = key_compare())
> +    map()
> +        _NOEXCEPT_(
> +            is_nothrow_default_constructible<allocator_type>::value &&
> +            is_nothrow_default_constructible<key_compare>::value &&
> +            is_nothrow_copy_constructible<key_compare>::value)
> +        : __tree_(__vc(key_compare())) {}
> +
> +    _LIBCPP_INLINE_VISIBILITY
> +    explicit map(const key_compare& __comp)
>          _NOEXCEPT_(
>              is_nothrow_default_constructible<allocator_type>::value &&
>              is_nothrow_default_constructible<key_compare>::value &&
>

The is_nothrow_default_constructible<key_compare>::value here looks
unnecessary; we don't default construct a key_compare here any more.


> @@ -1568,7 +1576,15 @@ public:
>      typedef _VSTD::reverse_iterator<const_iterator>
> const_reverse_iterator;
>
>      _LIBCPP_INLINE_VISIBILITY
> -    multimap(const key_compare& __comp = key_compare())
> +    multimap()
> +        _NOEXCEPT_(
> +            is_nothrow_default_constructible<allocator_type>::value &&
> +            is_nothrow_default_constructible<key_compare>::value &&
> +            is_nothrow_copy_constructible<key_compare>::value)
> +        : __tree_(__vc(key_compare())) {}
> +
> +    _LIBCPP_INLINE_VISIBILITY
> +    explicit multimap(const key_compare& __comp)
>          _NOEXCEPT_(
>              is_nothrow_default_constructible<allocator_type>::value &&
>              is_nothrow_default_constructible<key_compare>::value &&
>

Likewise.


>
> Modified: libcxx/trunk/include/set
> URL:
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/set?rev=203443&r1=203442&r2=203443&view=diff
>
> ==============================================================================
> --- libcxx/trunk/include/set (original)
> +++ libcxx/trunk/include/set Sun Mar  9 23:50:10 2014
> @@ -425,12 +425,21 @@ public:
>      typedef _VSTD::reverse_iterator<const_iterator>
> const_reverse_iterator;
>
>      _LIBCPP_INLINE_VISIBILITY
> -    set(const value_compare& __comp = value_compare())
> +    set()
> +        _NOEXCEPT_(
> +            is_nothrow_default_constructible<allocator_type>::value &&
> +            is_nothrow_default_constructible<key_compare>::value &&
> +            is_nothrow_copy_constructible<key_compare>::value)
> +        : __tree_(value_compare()) {}
> +
> +    _LIBCPP_INLINE_VISIBILITY
> +    explicit set(const value_compare& __comp)
>          _NOEXCEPT_(
>              is_nothrow_default_constructible<allocator_type>::value &&
>              is_nothrow_default_constructible<key_compare>::value &&
>

... and here. (Seems weird to use value_compare in the parameter and
key_compare in the exception specification, too...)


>              is_nothrow_copy_constructible<key_compare>::value)
>          : __tree_(__comp) {}
> +
>      _LIBCPP_INLINE_VISIBILITY
>      explicit set(const value_compare& __comp, const allocator_type& __a)
>          : __tree_(__comp, __a) {}
> @@ -822,12 +831,21 @@ public:
>
>      // construct/copy/destroy:
>      _LIBCPP_INLINE_VISIBILITY
> -    multiset(const value_compare& __comp = value_compare())
> +    multiset()
> +        _NOEXCEPT_(
> +            is_nothrow_default_constructible<allocator_type>::value &&
> +            is_nothrow_default_constructible<key_compare>::value &&
> +            is_nothrow_copy_constructible<key_compare>::value)
> +        : __tree_(value_compare()) {}
> +
> +    _LIBCPP_INLINE_VISIBILITY
> +    explicit multiset(const value_compare& __comp)
>          _NOEXCEPT_(
>              is_nothrow_default_constructible<allocator_type>::value &&
>              is_nothrow_default_constructible<key_compare>::value &&
>

Likewise.


>              is_nothrow_copy_constructible<key_compare>::value)
>          : __tree_(__comp) {}
> +
>      _LIBCPP_INLINE_VISIBILITY
>      explicit multiset(const value_compare& __comp, const allocator_type&
> __a)
>          : __tree_(__comp, __a) {}
>
>
> _______________________________________________
> 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/20140415/b91d2b47/attachment.html>


More information about the cfe-commits mailing list