[libcxx] r191626 - Implement n3789; constexpr support in named function objects

Marshall Clow mclow.lists at gmail.com
Sat Sep 28 12:06:13 PDT 2013


Author: marshall
Date: Sat Sep 28 14:06:12 2013
New Revision: 191626

URL: http://llvm.org/viewvc/llvm-project?rev=191626&view=rev
Log:
Implement n3789; constexpr support in named function objects

Modified:
    libcxx/trunk/include/__functional_base
    libcxx/trunk/include/functional
    libcxx/trunk/test/utilities/function.objects/arithmetic.operations/divides.pass.cpp
    libcxx/trunk/test/utilities/function.objects/arithmetic.operations/minus.pass.cpp
    libcxx/trunk/test/utilities/function.objects/arithmetic.operations/modulus.pass.cpp
    libcxx/trunk/test/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp
    libcxx/trunk/test/utilities/function.objects/arithmetic.operations/negate.pass.cpp
    libcxx/trunk/test/utilities/function.objects/arithmetic.operations/plus.pass.cpp
    libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_and.pass.cpp
    libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_not.pass.cpp
    libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_or.pass.cpp
    libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp
    libcxx/trunk/test/utilities/function.objects/comparisons/equal_to.pass.cpp
    libcxx/trunk/test/utilities/function.objects/comparisons/greater.pass.cpp
    libcxx/trunk/test/utilities/function.objects/comparisons/greater_equal.pass.cpp
    libcxx/trunk/test/utilities/function.objects/comparisons/less.pass.cpp
    libcxx/trunk/test/utilities/function.objects/comparisons/less_equal.pass.cpp
    libcxx/trunk/test/utilities/function.objects/comparisons/not_equal_to.pass.cpp
    libcxx/trunk/test/utilities/function.objects/logical.operations/logical_and.pass.cpp
    libcxx/trunk/test/utilities/function.objects/logical.operations/logical_not.pass.cpp
    libcxx/trunk/test/utilities/function.objects/logical.operations/logical_or.pass.cpp

Modified: libcxx/trunk/include/__functional_base
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__functional_base?rev=191626&r1=191625&r2=191626&view=diff
==============================================================================
--- libcxx/trunk/include/__functional_base (original)
+++ libcxx/trunk/include/__functional_base Sat Sep 28 14:06:12 2013
@@ -58,7 +58,8 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TYPE_VIS_ONLY less : binary_function<_Tp, _Tp, bool>
 {
-    _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 
+    bool operator()(const _Tp& __x, const _Tp& __y) const
         {return __x < __y;}
 };
 
@@ -66,7 +67,8 @@ struct _LIBCPP_TYPE_VIS_ONLY less : bina
 template <>
 struct _LIBCPP_TYPE_VIS_ONLY less<void>
 {
-    template <class _T1, class _T2> _LIBCPP_INLINE_VISIBILITY
+    template <class _T1, class _T2> 
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     auto operator()(_T1&& __t, _T2&& __u) const
         { return _VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u); }
     typedef void is_transparent;

Modified: libcxx/trunk/include/functional
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/functional?rev=191626&r1=191625&r2=191626&view=diff
==============================================================================
--- libcxx/trunk/include/functional (original)
+++ libcxx/trunk/include/functional Sat Sep 28 14:06:12 2013
@@ -492,7 +492,8 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TYPE_VIS_ONLY plus : binary_function<_Tp, _Tp, _Tp>
 {
-    _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x, const _Tp& __y) const
         {return __x + __y;}
 };
 
@@ -501,7 +502,8 @@ template <>
 struct _LIBCPP_TYPE_VIS_ONLY plus<void>
 {
     template <class _T1, class _T2>
-    _LIBCPP_INLINE_VISIBILITY auto operator()(_T1&& __t, _T2&& __u) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    auto operator()(_T1&& __t, _T2&& __u) const
         { return _VSTD::forward<_T1>(__t) + _VSTD::forward<_T2>(__u); }
     typedef void is_transparent;
 };
@@ -515,7 +517,8 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TYPE_VIS_ONLY minus : binary_function<_Tp, _Tp, _Tp>
 {
-    _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x, const _Tp& __y) const
         {return __x - __y;}
 };
 
@@ -524,7 +527,8 @@ template <>
 struct _LIBCPP_TYPE_VIS_ONLY minus<void>
 {
     template <class _T1, class _T2>
-    _LIBCPP_INLINE_VISIBILITY auto operator()(_T1&& __t, _T2&& __u) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    auto operator()(_T1&& __t, _T2&& __u) const
         { return _VSTD::forward<_T1>(__t) - _VSTD::forward<_T2>(__u); }
     typedef void is_transparent;
 };
@@ -538,7 +542,8 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TYPE_VIS_ONLY multiplies : binary_function<_Tp, _Tp, _Tp>
 {
-    _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x, const _Tp& __y) const
         {return __x * __y;}
 };
 
@@ -547,7 +552,8 @@ template <>
 struct _LIBCPP_TYPE_VIS_ONLY multiplies<void>
 {
     template <class _T1, class _T2>
-    _LIBCPP_INLINE_VISIBILITY auto operator()(_T1&& __t, _T2&& __u) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    auto operator()(_T1&& __t, _T2&& __u) const
         { return _VSTD::forward<_T1>(__t) * _VSTD::forward<_T2>(__u); }
     typedef void is_transparent;
 };
@@ -561,7 +567,8 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TYPE_VIS_ONLY divides : binary_function<_Tp, _Tp, _Tp>
 {
-    _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x, const _Tp& __y) const
         {return __x / __y;}
 };
 
@@ -570,7 +577,8 @@ template <>
 struct _LIBCPP_TYPE_VIS_ONLY divides<void>
 {
     template <class _T1, class _T2>
-    _LIBCPP_INLINE_VISIBILITY auto operator()(_T1&& __t, _T2&& __u) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    auto operator()(_T1&& __t, _T2&& __u) const
         { return _VSTD::forward<_T1>(__t) / _VSTD::forward<_T2>(__u); }
     typedef void is_transparent;
 };
@@ -584,7 +592,8 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TYPE_VIS_ONLY modulus : binary_function<_Tp, _Tp, _Tp>
 {
-    _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x, const _Tp& __y) const
         {return __x % __y;}
 };
 
@@ -593,7 +602,8 @@ template <>
 struct _LIBCPP_TYPE_VIS_ONLY modulus<void>
 {
     template <class _T1, class _T2>
-    _LIBCPP_INLINE_VISIBILITY auto operator()(_T1&& __t, _T2&& __u) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    auto operator()(_T1&& __t, _T2&& __u) const
         { return _VSTD::forward<_T1>(__t) % _VSTD::forward<_T2>(__u); }
     typedef void is_transparent;
 };
@@ -607,7 +617,8 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TYPE_VIS_ONLY negate : unary_function<_Tp, _Tp>
 {
-    _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x) const
         {return -__x;}
 };
 
@@ -616,7 +627,8 @@ template <>
 struct _LIBCPP_TYPE_VIS_ONLY negate<void>
 {
     template <class _Tp>
-    _LIBCPP_INLINE_VISIBILITY auto operator()(_Tp&& __x) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    auto operator()(_Tp&& __x) const
         { return -_VSTD::forward<_Tp>(__x); }
     typedef void is_transparent;
 };
@@ -630,7 +642,8 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TYPE_VIS_ONLY equal_to : binary_function<_Tp, _Tp, bool>
 {
-    _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Tp& __x, const _Tp& __y) const
         {return __x == __y;}
 };
 
@@ -638,7 +651,8 @@ struct _LIBCPP_TYPE_VIS_ONLY equal_to :
 template <>
 struct _LIBCPP_TYPE_VIS_ONLY equal_to<void>
 {
-    template <class _T1, class _T2> _LIBCPP_INLINE_VISIBILITY
+    template <class _T1, class _T2>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     auto operator()(_T1&& __t, _T2&& __u) const
         { return _VSTD::forward<_T1>(__t) == _VSTD::forward<_T2>(__u); }
     typedef void is_transparent;
@@ -653,7 +667,8 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TYPE_VIS_ONLY not_equal_to : binary_function<_Tp, _Tp, bool>
 {
-    _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Tp& __x, const _Tp& __y) const
         {return __x != __y;}
 };
 
@@ -661,7 +676,8 @@ struct _LIBCPP_TYPE_VIS_ONLY not_equal_t
 template <>
 struct _LIBCPP_TYPE_VIS_ONLY not_equal_to<void>
 {
-    template <class _T1, class _T2> _LIBCPP_INLINE_VISIBILITY
+    template <class _T1, class _T2>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     auto operator()(_T1&& __t, _T2&& __u) const
         { return _VSTD::forward<_T1>(__t) != _VSTD::forward<_T2>(__u); }
     typedef void is_transparent;
@@ -676,7 +692,8 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TYPE_VIS_ONLY greater : binary_function<_Tp, _Tp, bool>
 {
-    _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Tp& __x, const _Tp& __y) const
         {return __x > __y;}
 };
 
@@ -684,7 +701,8 @@ struct _LIBCPP_TYPE_VIS_ONLY greater : b
 template <>
 struct _LIBCPP_TYPE_VIS_ONLY greater<void>
 {
-    template <class _T1, class _T2> _LIBCPP_INLINE_VISIBILITY
+    template <class _T1, class _T2>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     auto operator()(_T1&& __t, _T2&& __u) const
         { return _VSTD::forward<_T1>(__t) > _VSTD::forward<_T2>(__u); }
     typedef void is_transparent;
@@ -701,7 +719,8 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TYPE_VIS_ONLY greater_equal : binary_function<_Tp, _Tp, bool>
 {
-    _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Tp& __x, const _Tp& __y) const
         {return __x >= __y;}
 };
 
@@ -709,7 +728,8 @@ struct _LIBCPP_TYPE_VIS_ONLY greater_equ
 template <>
 struct _LIBCPP_TYPE_VIS_ONLY greater_equal<void>
 {
-    template <class _T1, class _T2> _LIBCPP_INLINE_VISIBILITY
+    template <class _T1, class _T2>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     auto operator()(_T1&& __t, _T2&& __u) const
         { return _VSTD::forward<_T1>(__t) >= _VSTD::forward<_T2>(__u); }
     typedef void is_transparent;
@@ -724,7 +744,8 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TYPE_VIS_ONLY less_equal : binary_function<_Tp, _Tp, bool>
 {
-    _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Tp& __x, const _Tp& __y) const
         {return __x <= __y;}
 };
 
@@ -732,7 +753,8 @@ struct _LIBCPP_TYPE_VIS_ONLY less_equal
 template <>
 struct _LIBCPP_TYPE_VIS_ONLY less_equal<void>
 {
-    template <class _T1, class _T2> _LIBCPP_INLINE_VISIBILITY
+    template <class _T1, class _T2>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     auto operator()(_T1&& __t, _T2&& __u) const
         { return _VSTD::forward<_T1>(__t) <= _VSTD::forward<_T2>(__u); }
     typedef void is_transparent;
@@ -747,7 +769,8 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TYPE_VIS_ONLY logical_and : binary_function<_Tp, _Tp, bool>
 {
-    _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Tp& __x, const _Tp& __y) const
         {return __x && __y;}
 };
 
@@ -755,7 +778,8 @@ struct _LIBCPP_TYPE_VIS_ONLY logical_and
 template <>
 struct _LIBCPP_TYPE_VIS_ONLY logical_and<void>
 {
-    template <class _T1, class _T2> _LIBCPP_INLINE_VISIBILITY
+    template <class _T1, class _T2>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     auto operator()(_T1&& __t, _T2&& __u) const
         { return _VSTD::forward<_T1>(__t) && _VSTD::forward<_T2>(__u); }
     typedef void is_transparent;
@@ -770,7 +794,8 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TYPE_VIS_ONLY logical_or : binary_function<_Tp, _Tp, bool>
 {
-    _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Tp& __x, const _Tp& __y) const
         {return __x || __y;}
 };
 
@@ -778,7 +803,8 @@ struct _LIBCPP_TYPE_VIS_ONLY logical_or
 template <>
 struct _LIBCPP_TYPE_VIS_ONLY logical_or<void>
 {
-    template <class _T1, class _T2> _LIBCPP_INLINE_VISIBILITY
+    template <class _T1, class _T2>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     auto operator()(_T1&& __t, _T2&& __u) const
         { return _VSTD::forward<_T1>(__t) || _VSTD::forward<_T2>(__u); }
     typedef void is_transparent;
@@ -793,7 +819,8 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TYPE_VIS_ONLY logical_not : unary_function<_Tp, bool>
 {
-    _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Tp& __x) const
         {return !__x;}
 };
 
@@ -802,7 +829,8 @@ template <>
 struct _LIBCPP_TYPE_VIS_ONLY logical_not<void>
 {
     template <class _Tp>
-    _LIBCPP_INLINE_VISIBILITY auto operator()(_Tp&& __x) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    auto operator()(_Tp&& __x) const
         { return !_VSTD::forward<_Tp>(__x); }
     typedef void is_transparent;
 };
@@ -816,7 +844,8 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TYPE_VIS_ONLY bit_and : binary_function<_Tp, _Tp, _Tp>
 {
-    _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x, const _Tp& __y) const
         {return __x & __y;}
 };
 
@@ -824,7 +853,8 @@ struct _LIBCPP_TYPE_VIS_ONLY bit_and : b
 template <>
 struct _LIBCPP_TYPE_VIS_ONLY bit_and<void>
 {
-    template <class _T1, class _T2> _LIBCPP_INLINE_VISIBILITY
+    template <class _T1, class _T2>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     auto operator()(_T1&& __t, _T2&& __u) const
         { return _VSTD::forward<_T1>(__t) & _VSTD::forward<_T2>(__u); }
     typedef void is_transparent;
@@ -839,7 +869,8 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TYPE_VIS_ONLY bit_or : binary_function<_Tp, _Tp, _Tp>
 {
-    _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x, const _Tp& __y) const
         {return __x | __y;}
 };
 
@@ -847,7 +878,8 @@ struct _LIBCPP_TYPE_VIS_ONLY bit_or : bi
 template <>
 struct _LIBCPP_TYPE_VIS_ONLY bit_or<void>
 {
-    template <class _T1, class _T2> _LIBCPP_INLINE_VISIBILITY
+    template <class _T1, class _T2>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     auto operator()(_T1&& __t, _T2&& __u) const
         { return _VSTD::forward<_T1>(__t) | _VSTD::forward<_T2>(__u); }
     typedef void is_transparent;
@@ -862,7 +894,8 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TYPE_VIS_ONLY bit_xor : binary_function<_Tp, _Tp, _Tp>
 {
-    _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x, const _Tp& __y) const
         {return __x ^ __y;}
 };
 
@@ -870,7 +903,8 @@ struct _LIBCPP_TYPE_VIS_ONLY bit_xor : b
 template <>
 struct _LIBCPP_TYPE_VIS_ONLY bit_xor<void>
 {
-    template <class _T1, class _T2> _LIBCPP_INLINE_VISIBILITY
+    template <class _T1, class _T2>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     auto operator()(_T1&& __t, _T2&& __u) const
         { return _VSTD::forward<_T1>(__t) ^ _VSTD::forward<_T2>(__u); }
     typedef void is_transparent;
@@ -882,7 +916,8 @@ struct _LIBCPP_TYPE_VIS_ONLY bit_xor<voi
 template <class _Tp = void>
 struct _LIBCPP_TYPE_VIS_ONLY bit_not : unary_function<_Tp, _Tp>
 {
-    _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x) const
         {return ~__x;}
 };
 
@@ -890,7 +925,8 @@ template <>
 struct _LIBCPP_TYPE_VIS_ONLY bit_not<void>
 {
     template <class _Tp>
-    _LIBCPP_INLINE_VISIBILITY auto operator()(_Tp&& __x) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    auto operator()(_Tp&& __x) const
         { return ~_VSTD::forward<_Tp>(__x); }
     typedef void is_transparent;
 };
@@ -902,14 +938,16 @@ class _LIBCPP_TYPE_VIS_ONLY unary_negate
 {
     _Predicate __pred_;
 public:
-    _LIBCPP_INLINE_VISIBILITY explicit unary_negate(const _Predicate& __pred)
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    explicit unary_negate(const _Predicate& __pred)
         : __pred_(__pred) {}
-    _LIBCPP_INLINE_VISIBILITY bool operator()(const typename _Predicate::argument_type& __x) const
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const typename _Predicate::argument_type& __x) const
         {return !__pred_(__x);}
 };
 
 template <class _Predicate>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
 unary_negate<_Predicate>
 not1(const _Predicate& __pred) {return unary_negate<_Predicate>(__pred);}
 
@@ -921,15 +959,17 @@ class _LIBCPP_TYPE_VIS_ONLY binary_negat
 {
     _Predicate __pred_;
 public:
-    _LIBCPP_INLINE_VISIBILITY explicit binary_negate(const _Predicate& __pred)
-        : __pred_(__pred) {}
-    _LIBCPP_INLINE_VISIBILITY bool operator()(const typename _Predicate::first_argument_type& __x,
+    _LIBCPP_INLINE_VISIBILITY explicit _LIBCPP_CONSTEXPR_AFTER_CXX11 
+    binary_negate(const _Predicate& __pred) : __pred_(__pred) {}
+
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const typename _Predicate::first_argument_type& __x,
                     const typename _Predicate::second_argument_type& __y) const
         {return !__pred_(__x, __y);}
 };
 
 template <class _Predicate>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
 binary_negate<_Predicate>
 not2(const _Predicate& __pred) {return binary_negate<_Predicate>(__pred);}
 

Modified: libcxx/trunk/test/utilities/function.objects/arithmetic.operations/divides.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/arithmetic.operations/divides.pass.cpp?rev=191626&r1=191625&r2=191626&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/arithmetic.operations/divides.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/arithmetic.operations/divides.pass.cpp Sat Sep 28 14:06:12 2013
@@ -27,5 +27,11 @@ int main()
     assert(f2(36, 4) == 9);
     assert(f2(36.0, 4) == 9);
     assert(f2(18, 4.0) == 4.5); // exact in binary
+
+    constexpr int foo = std::divides<int> () (3, 2);
+    static_assert ( foo == 1, "" );
+
+    constexpr int bar = std::divides<> () (3.0, 2);
+    static_assert ( bar == 1, "" );
 #endif
 }

Modified: libcxx/trunk/test/utilities/function.objects/arithmetic.operations/minus.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/arithmetic.operations/minus.pass.cpp?rev=191626&r1=191625&r2=191626&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/arithmetic.operations/minus.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/arithmetic.operations/minus.pass.cpp Sat Sep 28 14:06:12 2013
@@ -27,5 +27,11 @@ int main()
     assert(f2(3,2) == 1);
     assert(f2(3.0, 2) == 1);
     assert(f2(3, 2.5) == 0.5);
+
+    constexpr int foo = std::minus<int> () (3, 2);
+    static_assert ( foo == 1, "" );
+
+    constexpr int bar = std::minus<> () (3.0, 2);
+    static_assert ( bar == 1, "" );
 #endif
 }

Modified: libcxx/trunk/test/utilities/function.objects/arithmetic.operations/modulus.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/arithmetic.operations/modulus.pass.cpp?rev=191626&r1=191625&r2=191626&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/arithmetic.operations/modulus.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/arithmetic.operations/modulus.pass.cpp Sat Sep 28 14:06:12 2013
@@ -27,5 +27,11 @@ int main()
     assert(f2(36, 8) == 4);
     assert(f2(36L, 8) == 4);
     assert(f2(36, 8L) == 4);
+
+    constexpr int foo = std::modulus<int> () (3, 2);
+    static_assert ( foo == 1, "" );
+
+    constexpr int bar = std::modulus<> () (3L, 2);
+    static_assert ( bar == 1, "" );
 #endif
 }

Modified: libcxx/trunk/test/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp?rev=191626&r1=191625&r2=191626&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp Sat Sep 28 14:06:12 2013
@@ -27,5 +27,11 @@ int main()
     assert(f2(3,2) == 6);
     assert(f2(3.0, 2) == 6);
     assert(f2(3, 2.5) == 7.5); // exact in binary
+
+    constexpr int foo = std::multiplies<int> () (3, 2);
+    static_assert ( foo == 6, "" );
+
+    constexpr int bar = std::multiplies<> () (3.0, 2);
+    static_assert ( bar == 6, "" );
 #endif
 }

Modified: libcxx/trunk/test/utilities/function.objects/arithmetic.operations/negate.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/arithmetic.operations/negate.pass.cpp?rev=191626&r1=191625&r2=191626&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/arithmetic.operations/negate.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/arithmetic.operations/negate.pass.cpp Sat Sep 28 14:06:12 2013
@@ -27,5 +27,11 @@ int main()
     assert(f2(36) == -36);
     assert(f2(36L) == -36);
     assert(f2(36.0) == -36);
+
+    constexpr int foo = std::negate<int> () (3);
+    static_assert ( foo == -3, "" );
+
+    constexpr int bar = std::negate<> () (3.0);
+    static_assert ( bar == -3, "" );
 #endif
 }

Modified: libcxx/trunk/test/utilities/function.objects/arithmetic.operations/plus.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/arithmetic.operations/plus.pass.cpp?rev=191626&r1=191625&r2=191626&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/arithmetic.operations/plus.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/arithmetic.operations/plus.pass.cpp Sat Sep 28 14:06:12 2013
@@ -27,5 +27,11 @@ int main()
     assert(f2(3,2) == 5);
     assert(f2(3.0, 2) == 5);
     assert(f2(3, 2.5) == 5.5);
+    
+    constexpr int foo = std::plus<int> () (3, 2);
+    static_assert ( foo == 5, "" );
+
+    constexpr int bar = std::plus<> () (3.0, 2);
+    static_assert ( bar == 5, "" );
 #endif
 }

Modified: libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_and.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_and.pass.cpp?rev=191626&r1=191625&r2=191626&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_and.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_and.pass.cpp Sat Sep 28 14:06:12 2013
@@ -47,5 +47,11 @@ int main()
     assert(f2(0xFFFF, 0x58D3) == 0x58D3);
     assert(f2(0xFFFFL, 0x58D3) == 0x58D3);
     assert(f2(0xFFFF, 0x58D3L) == 0x58D3);
+
+    constexpr int foo = std::bit_and<int> () (0x58D3, 0xEA95);
+    static_assert ( foo == 0x4891, "" );
+
+    constexpr int bar = std::bit_and<> () (0x58D3L, 0xEA95);
+    static_assert ( bar == 0x4891, "" );
 #endif
 }

Modified: libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_not.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_not.pass.cpp?rev=191626&r1=191625&r2=191626&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_not.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_not.pass.cpp Sat Sep 28 14:06:12 2013
@@ -36,5 +36,11 @@ int main()
     assert((f2(0L)      & 0xFFFF ) == 0xFFFF);
     assert((f2(0xFFFF)  & 0xFFFF ) == 0);
     assert((f2(0xFFFFL)  & 0xFFFF ) == 0);
+
+    constexpr int foo = std::bit_not<int> () (0xEA95) & 0xFFFF;
+    static_assert ( foo == 0x156A, "" );
+
+    constexpr int bar = std::bit_not<> () (0xEA95) & 0xFFFF;
+    static_assert ( bar == 0x156A, "" );
 #endif
 }

Modified: libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_or.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_or.pass.cpp?rev=191626&r1=191625&r2=191626&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_or.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_or.pass.cpp Sat Sep 28 14:06:12 2013
@@ -47,5 +47,11 @@ int main()
     assert(f2(0xFFFF, 0x58D3) == 0xFFFF);
     assert(f2(0xFFFFL, 0x58D3) == 0xFFFF);
     assert(f2(0xFFFF, 0x58D3L) == 0xFFFF);
+
+    constexpr int foo = std::bit_or<int> () (0x58D3, 0xEA95);
+    static_assert ( foo == 0xFAD7, "" );
+
+    constexpr int bar = std::bit_or<> () (0x58D3L, 0xEA95);
+    static_assert ( bar == 0xFAD7, "" );
 #endif
 }

Modified: libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp?rev=191626&r1=191625&r2=191626&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp Sat Sep 28 14:06:12 2013
@@ -47,5 +47,11 @@ int main()
     assert(f(0xFFFF, 0x58D3) == 0xA72C);
     assert(f(0xFFFFL, 0x58D3) == 0xA72C);
     assert(f(0xFFFF, 0x58D3L) == 0xA72C);
+
+    constexpr int foo = std::bit_xor<int> () (0x58D3, 0xEA95);
+    static_assert ( foo == 0xB246, "" );
+
+    constexpr int bar = std::bit_xor<> () (0x58D3L, 0xEA95);
+    static_assert ( bar == 0xB246, "" );
 #endif
 }

Modified: libcxx/trunk/test/utilities/function.objects/comparisons/equal_to.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/comparisons/equal_to.pass.cpp?rev=191626&r1=191625&r2=191626&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/comparisons/equal_to.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/comparisons/equal_to.pass.cpp Sat Sep 28 14:06:12 2013
@@ -29,5 +29,11 @@ int main()
     assert(!f2(36, 6));
     assert(f2(36, 36.0));
     assert(f2(36.0, 36L));
+
+    constexpr bool foo = std::equal_to<int> () (36, 36);
+    static_assert ( foo, "" );
+
+    constexpr bool bar = std::equal_to<> () (36.0, 36);
+    static_assert ( bar, "" );
 #endif
 }

Modified: libcxx/trunk/test/utilities/function.objects/comparisons/greater.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/comparisons/greater.pass.cpp?rev=191626&r1=191625&r2=191626&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/comparisons/greater.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/comparisons/greater.pass.cpp Sat Sep 28 14:06:12 2013
@@ -33,5 +33,11 @@ int main()
     assert( f2(36.0, 6));
     assert(!f2(6, 36.0));
     assert(!f2(6.0, 36));
+
+    constexpr bool foo = std::greater<int> () (36, 36);
+    static_assert ( !foo, "" );
+
+    constexpr bool bar = std::greater<> () (36.0, 36);
+    static_assert ( !bar, "" );
 #endif
 }

Modified: libcxx/trunk/test/utilities/function.objects/comparisons/greater_equal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/comparisons/greater_equal.pass.cpp?rev=191626&r1=191625&r2=191626&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/comparisons/greater_equal.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/comparisons/greater_equal.pass.cpp Sat Sep 28 14:06:12 2013
@@ -33,5 +33,11 @@ int main()
     assert( f2(36.0, 6));
     assert(!f2(6, 36.0));
     assert(!f2(6.0, 36));
+
+    constexpr bool foo = std::greater_equal<int> () (36, 36);
+    static_assert ( foo, "" );
+
+    constexpr bool bar = std::greater_equal<> () (36.0, 36);
+    static_assert ( bar, "" );
 #endif
 }

Modified: libcxx/trunk/test/utilities/function.objects/comparisons/less.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/comparisons/less.pass.cpp?rev=191626&r1=191625&r2=191626&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/comparisons/less.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/comparisons/less.pass.cpp Sat Sep 28 14:06:12 2013
@@ -33,5 +33,11 @@ int main()
     assert(!f2(36.0, 6));
     assert( f2(6, 36.0));
     assert( f2(6.0, 36));
+
+    constexpr bool foo = std::less<int> () (36, 36);
+    static_assert ( !foo, "" );
+
+    constexpr bool bar = std::less<> () (36.0, 36);
+    static_assert ( !bar, "" );
 #endif
 }

Modified: libcxx/trunk/test/utilities/function.objects/comparisons/less_equal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/comparisons/less_equal.pass.cpp?rev=191626&r1=191625&r2=191626&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/comparisons/less_equal.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/comparisons/less_equal.pass.cpp Sat Sep 28 14:06:12 2013
@@ -33,5 +33,11 @@ int main()
     assert(!f2(36.0, 6));
     assert( f2(6, 36.0));
     assert( f2(6.0, 36));
+
+    constexpr bool foo = std::less_equal<int> () (36, 36);
+    static_assert ( foo, "" );
+
+    constexpr bool bar = std::less_equal<> () (36.0, 36);
+    static_assert ( bar, "" );
 #endif
 }

Modified: libcxx/trunk/test/utilities/function.objects/comparisons/not_equal_to.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/comparisons/not_equal_to.pass.cpp?rev=191626&r1=191625&r2=191626&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/comparisons/not_equal_to.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/comparisons/not_equal_to.pass.cpp Sat Sep 28 14:06:12 2013
@@ -31,5 +31,11 @@ int main()
     assert( f2(36.0, 6));
     assert(!f2(36.0, 36));
     assert(!f2(36, 36.0));
+
+    constexpr bool foo = std::not_equal_to<int> () (36, 36);
+    static_assert ( !foo, "" );
+
+    constexpr bool bar = std::not_equal_to<> () (36.0, 36);
+    static_assert ( !bar, "" );
 #endif
 }

Modified: libcxx/trunk/test/utilities/function.objects/logical.operations/logical_and.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/logical.operations/logical_and.pass.cpp?rev=191626&r1=191625&r2=191626&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/logical.operations/logical_and.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/logical.operations/logical_and.pass.cpp Sat Sep 28 14:06:12 2013
@@ -38,5 +38,11 @@ int main()
     assert( f2(36L, 36));
     assert(!f2(36L, 0));
     assert(!f2(0L, 36));
+
+    constexpr bool foo = std::logical_and<int> () (36, 36);
+    static_assert ( foo, "" );
+
+    constexpr bool bar = std::logical_and<> () (36.0, 36);
+    static_assert ( bar, "" );
 #endif
 }

Modified: libcxx/trunk/test/utilities/function.objects/logical.operations/logical_not.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/logical.operations/logical_not.pass.cpp?rev=191626&r1=191625&r2=191626&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/logical.operations/logical_not.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/logical.operations/logical_not.pass.cpp Sat Sep 28 14:06:12 2013
@@ -29,5 +29,11 @@ int main()
     assert( f2(0));
     assert(!f2(36L));
     assert( f2(0L));
+
+    constexpr bool foo = std::logical_not<int> () (36);
+    static_assert ( !foo, "" );
+
+    constexpr bool bar = std::logical_not<> () (36);
+    static_assert ( !bar, "" );
 #endif
 }

Modified: libcxx/trunk/test/utilities/function.objects/logical.operations/logical_or.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/logical.operations/logical_or.pass.cpp?rev=191626&r1=191625&r2=191626&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/logical.operations/logical_or.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/logical.operations/logical_or.pass.cpp Sat Sep 28 14:06:12 2013
@@ -37,5 +37,11 @@ int main()
     assert(!f2(0, 0));
     assert(!f2(0, 0L));
     assert(!f2(0L, 0));
+
+    constexpr bool foo = std::logical_or<int> () (36, 36);
+    static_assert ( foo, "" );
+
+    constexpr bool bar = std::logical_or<> () (36.0, 36);
+    static_assert ( bar, "" );
 #endif
 }





More information about the cfe-commits mailing list