purely as an extension. See :ref:`Extended Applications of [[nodiscard]] <nodiscard extension>`
for more information.
+**_LIBCPP_ENABLE_DEPRECATION_WARNINGS**:
+ This macro enables warnings when using deprecated components. For example,
+ when compiling in C++11 mode, using `std::auto_ptr` with the macro defined
+ will trigger a warning saying that `std::auto_ptr` is deprecated. By default,
+ this macro is not defined.
C++17 Specific Configuration Macros
-----------------------------------
#define _LIBCPP_WCTYPE_IS_MASK
#endif
-#if _LIBCPP_STD_VER > 11
-# define _LIBCPP_DEPRECATED [[deprecated]]
+// Deprecation macros.
+// Deprecations warnings are only enabled when _LIBCPP_ENABLE_DEPRECATION_WARNINGS is defined.
+#if defined(_LIBCPP_ENABLE_DEPRECATION_WARNINGS)
+# if __has_attribute(deprecated)
+# define _LIBCPP_DEPRECATED __attribute__ ((deprecated))
+# elif _LIBCPP_STD_VER > 11
+# define _LIBCPP_DEPRECATED [[deprecated]]
+# else
+# define _LIBCPP_DEPRECATED
+# endif
#else
# define _LIBCPP_DEPRECATED
#endif
+#if !defined(_LIBCPP_CXX03_LANG)
+# define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED
+#else
+# define _LIBCPP_DEPRECATED_IN_CXX11
+#endif
+
+#if _LIBCPP_STD_VER >= 14
+# define _LIBCPP_DEPRECATED_IN_CXX14 _LIBCPP_DEPRECATED
+#else
+# define _LIBCPP_DEPRECATED_IN_CXX14
+#endif
+
+#if _LIBCPP_STD_VER >= 17
+# define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED
+#else
+# define _LIBCPP_DEPRECATED_IN_CXX17
+#endif
+
#if _LIBCPP_STD_VER <= 11
# define _LIBCPP_EXPLICIT_AFTER_CXX11
-# define _LIBCPP_DEPRECATED_AFTER_CXX11
#else
# define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
-# define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]]
#endif
#if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
#endif
struct _LIBCPP_TEMPLATE_VIS less : binary_function<_Tp, _Tp, bool>
{
- _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Tp& __y) const
{return __x < __y;}
};
template <>
struct _LIBCPP_TEMPLATE_VIS less<void>
{
- template <class _T1, class _T2>
+ template <class _T1, class _T2>
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
auto operator()(_T1&& __t, _T2&& __u) const
_NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u)))
struct __is_transparent : false_type {};
template <class _Tp, class _Up>
-struct __is_transparent<_Tp, _Up,
+struct __is_transparent<_Tp, _Up,
typename __void_t<typename _Tp::is_transparent>::type>
: true_type {};
#endif
_LIBCPP_FUNC_VIS __rs_default __rs_get();
template <class _RandomAccessIterator>
-void
+_LIBCPP_DEPRECATED_IN_CXX14 void
random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
{
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
}
template <class _RandomAccessIterator, class _RandomNumberGenerator>
-void
+_LIBCPP_DEPRECATED_IN_CXX14 void
random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
#ifndef _LIBCPP_CXX03_LANG
_RandomNumberGenerator&& __rand)
};
template <class Predicate>
-class unary_negate
+class unary_negate // deprecated in C++17
: public unary_function<typename Predicate::argument_type, bool>
{
public:
bool operator()(const typename Predicate::argument_type& x) const;
};
-template <class Predicate> unary_negate<Predicate> not1(const Predicate& pred);
+template <class Predicate> // deprecated in C++17
+unary_negate<Predicate> not1(const Predicate& pred);
template <class Predicate>
-class binary_negate
+class binary_negate // deprecated in C++17
: public binary_function<typename Predicate::first_argument_type,
typename Predicate::second_argument_type,
bool>
const typename Predicate::second_argument_type& y) const;
};
-template <class Predicate> binary_negate<Predicate> not2(const Predicate& pred);
+template <class Predicate> // deprecated in C++17
+binary_negate<Predicate> not2(const Predicate& pred);
template <class F> unspecified not_fn(F&& f); // C++17
#endif
template <class _Predicate>
-class _LIBCPP_TEMPLATE_VIS unary_negate
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 unary_negate
: public unary_function<typename _Predicate::argument_type, bool>
{
_Predicate __pred_;
};
template <class _Predicate>
-inline _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX17 inline _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
unary_negate<_Predicate>
not1(const _Predicate& __pred) {return unary_negate<_Predicate>(__pred);}
template <class _Predicate>
-class _LIBCPP_TEMPLATE_VIS binary_negate
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 binary_negate
: public binary_function<typename _Predicate::first_argument_type,
typename _Predicate::second_argument_type,
bool>
};
template <class _Predicate>
-inline _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX17 inline _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
binary_negate<_Predicate>
not2(const _Predicate& __pred) {return binary_negate<_Predicate>(__pred);}
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
template <class __Operation>
-class _LIBCPP_TEMPLATE_VIS binder1st
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binder1st
: public unary_function<typename __Operation::second_argument_type,
typename __Operation::result_type>
{
};
template <class __Operation, class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
binder1st<__Operation>
bind1st(const __Operation& __op, const _Tp& __x)
{return binder1st<__Operation>(__op, __x);}
template <class __Operation>
-class _LIBCPP_TEMPLATE_VIS binder2nd
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binder2nd
: public unary_function<typename __Operation::first_argument_type,
typename __Operation::result_type>
{
};
template <class __Operation, class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
binder2nd<__Operation>
bind2nd(const __Operation& __op, const _Tp& __x)
{return binder2nd<__Operation>(__op, __x);}
template <class _Arg, class _Result>
-class _LIBCPP_TEMPLATE_VIS pointer_to_unary_function
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 pointer_to_unary_function
: public unary_function<_Arg, _Result>
{
_Result (*__f_)(_Arg);
};
template <class _Arg, class _Result>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
pointer_to_unary_function<_Arg,_Result>
ptr_fun(_Result (*__f)(_Arg))
{return pointer_to_unary_function<_Arg,_Result>(__f);}
template <class _Arg1, class _Arg2, class _Result>
-class _LIBCPP_TEMPLATE_VIS pointer_to_binary_function
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 pointer_to_binary_function
: public binary_function<_Arg1, _Arg2, _Result>
{
_Result (*__f_)(_Arg1, _Arg2);
};
template <class _Arg1, class _Arg2, class _Result>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
pointer_to_binary_function<_Arg1,_Arg2,_Result>
ptr_fun(_Result (*__f)(_Arg1,_Arg2))
{return pointer_to_binary_function<_Arg1,_Arg2,_Result>(__f);}
template<class _Sp, class _Tp>
-class _LIBCPP_TEMPLATE_VIS mem_fun_t : public unary_function<_Tp*, _Sp>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun_t
+ : public unary_function<_Tp*, _Sp>
{
_Sp (_Tp::*__p_)();
public:
};
template<class _Sp, class _Tp, class _Ap>
-class _LIBCPP_TEMPLATE_VIS mem_fun1_t : public binary_function<_Tp*, _Ap, _Sp>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun1_t
+ : public binary_function<_Tp*, _Ap, _Sp>
{
_Sp (_Tp::*__p_)(_Ap);
public:
};
template<class _Sp, class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
mem_fun_t<_Sp,_Tp>
mem_fun(_Sp (_Tp::*__f)())
{return mem_fun_t<_Sp,_Tp>(__f);}
template<class _Sp, class _Tp, class _Ap>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
mem_fun1_t<_Sp,_Tp,_Ap>
mem_fun(_Sp (_Tp::*__f)(_Ap))
{return mem_fun1_t<_Sp,_Tp,_Ap>(__f);}
template<class _Sp, class _Tp>
-class _LIBCPP_TEMPLATE_VIS mem_fun_ref_t : public unary_function<_Tp, _Sp>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun_ref_t
+ : public unary_function<_Tp, _Sp>
{
_Sp (_Tp::*__p_)();
public:
};
template<class _Sp, class _Tp, class _Ap>
-class _LIBCPP_TEMPLATE_VIS mem_fun1_ref_t : public binary_function<_Tp, _Ap, _Sp>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun1_ref_t
+ : public binary_function<_Tp, _Ap, _Sp>
{
_Sp (_Tp::*__p_)(_Ap);
public:
};
template<class _Sp, class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
mem_fun_ref_t<_Sp,_Tp>
mem_fun_ref(_Sp (_Tp::*__f)())
{return mem_fun_ref_t<_Sp,_Tp>(__f);}
template<class _Sp, class _Tp, class _Ap>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
mem_fun1_ref_t<_Sp,_Tp,_Ap>
mem_fun_ref(_Sp (_Tp::*__f)(_Ap))
{return mem_fun1_ref_t<_Sp,_Tp,_Ap>(__f);}
template <class _Sp, class _Tp>
-class _LIBCPP_TEMPLATE_VIS const_mem_fun_t : public unary_function<const _Tp*, _Sp>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun_t
+ : public unary_function<const _Tp*, _Sp>
{
_Sp (_Tp::*__p_)() const;
public:
};
template <class _Sp, class _Tp, class _Ap>
-class _LIBCPP_TEMPLATE_VIS const_mem_fun1_t : public binary_function<const _Tp*, _Ap, _Sp>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun1_t
+ : public binary_function<const _Tp*, _Ap, _Sp>
{
_Sp (_Tp::*__p_)(_Ap) const;
public:
};
template <class _Sp, class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
const_mem_fun_t<_Sp,_Tp>
mem_fun(_Sp (_Tp::*__f)() const)
{return const_mem_fun_t<_Sp,_Tp>(__f);}
template <class _Sp, class _Tp, class _Ap>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
const_mem_fun1_t<_Sp,_Tp,_Ap>
mem_fun(_Sp (_Tp::*__f)(_Ap) const)
{return const_mem_fun1_t<_Sp,_Tp,_Ap>(__f);}
template <class _Sp, class _Tp>
-class _LIBCPP_TEMPLATE_VIS const_mem_fun_ref_t : public unary_function<_Tp, _Sp>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun_ref_t
+ : public unary_function<_Tp, _Sp>
{
_Sp (_Tp::*__p_)() const;
public:
};
template <class _Sp, class _Tp, class _Ap>
-class _LIBCPP_TEMPLATE_VIS const_mem_fun1_ref_t
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun1_ref_t
: public binary_function<_Tp, _Ap, _Sp>
{
_Sp (_Tp::*__p_)(_Ap) const;
};
template <class _Sp, class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
const_mem_fun_ref_t<_Sp,_Tp>
mem_fun_ref(_Sp (_Tp::*__f)() const)
{return const_mem_fun_ref_t<_Sp,_Tp>(__f);}
template <class _Sp, class _Tp, class _Ap>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
const_mem_fun1_ref_t<_Sp,_Tp,_Ap>
mem_fun_ref(_Sp (_Tp::*__f)(_Ap) const)
{return const_mem_fun1_ref_t<_Sp,_Tp,_Ap>(__f);}
template <class ForwardIterator, class Size>
ForwardIterator uninitialized_default_construct_n(ForwardIterator first, Size n);
-template <class Y> struct auto_ptr_ref {}; // removed in C++17
+template <class Y> struct auto_ptr_ref {}; // deprecated in C++11, removed in C++17
template<class X>
-class auto_ptr // removed in C++17
+class auto_ptr // deprecated in C++11, removed in C++17
{
public:
typedef X element_type;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
allocator() _NOEXCEPT {}
- template <class _Up>
+ template <class _Up>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
allocator(const allocator<_Up>&) _NOEXCEPT {}
{return _VSTD::addressof(__x);}
_LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const _NOEXCEPT
{return _VSTD::addressof(__x);}
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
pointer allocate(size_type __n, allocator<void>::const_pointer = 0)
{
if (__n > max_size())
allocator() _NOEXCEPT {}
template <class _Up>
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
allocator(const allocator<_Up>&) _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const _NOEXCEPT
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
template <class _Tp>
-struct auto_ptr_ref
+struct _LIBCPP_DEPRECATED_IN_CXX11 auto_ptr_ref
{
_Tp* __ptr_;
};
template<class _Tp>
-class _LIBCPP_TEMPLATE_VIS auto_ptr
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 auto_ptr
{
private:
_Tp* __ptr_;
};
template <>
-class _LIBCPP_TEMPLATE_VIS auto_ptr<void>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 auto_ptr<void>
{
public:
typedef void element_type;
//
//===----------------------------------------------------------------------===//
-// <memory>
+// <algorithm>
// template <class RandomAccessIterator>
// void
// However, for backwards compatibility, if _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
// is defined before including <algorithm>, then random_shuffle will be restored.
+// REQUIRES: verify-support
+
// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
#define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
--- /dev/null
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template <class RandomAccessIterator>
+// void
+// random_shuffle(RandomAccessIterator first, RandomAccessIterator last);
+//
+// template <class RandomAccessIterator, class RandomNumberGenerator>
+// void
+// random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
+// RandomNumberGenerator& rand);
+
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
+
+#include <algorithm>
+#include <cstddef>
+
+#include "test_macros.h"
+
+struct gen
+{
+ std::ptrdiff_t operator()(std::ptrdiff_t n)
+ {
+ return n-1;
+ }
+};
+
+
+int main()
+{
+#if TEST_STD_VER < 14
+ // expected-no-diagnostics
+#else
+ // expected-error@* 1 {{'random_shuffle<int *>' is deprecated}}
+ // expected-error@* 1 {{'random_shuffle<int *, gen &>' is deprecated}}
+#endif
+ int v[1] = {1};
+ std::random_shuffle(&v[0], &v[1]);
+ gen r;
+ std::random_shuffle(&v[0], &v[1], r);
+}
--- /dev/null
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+//
+// template <class X>
+// class auto_ptr;
+//
+// class auto_ptr<void>;
+//
+// template <class X>
+// class auto_ptr_ref;
+//
+// Deprecated in C++11
+
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
+
+#include <memory>
+#include "test_macros.h"
+
+int main()
+{
+#if TEST_STD_VER < 11
+ // expected-no-diagnostics
+#else
+ // expected-error@* 1 {{'auto_ptr<int>' is deprecated}}
+ // expected-error@* 1 {{'auto_ptr<void>' is deprecated}}
+ // expected-error@* 1 {{'auto_ptr_ref<int>' is deprecated}}
+#endif
+ typedef std::auto_ptr<int> AP;
+ typedef std::auto_ptr<void> APV;
+ typedef std::auto_ptr_ref<int> APR;
+}
--- /dev/null
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+
+#include <functional>
+#include <cassert>
+#include "test_macros.h"
+
+int identity(int v) { return v; }
+int sum(int a, int b) { return a + b; }
+
+struct Foo {
+ int const_zero() const { return 0; }
+ int const_identity(int v) const { return v; }
+ int zero() { return 0; }
+ int identity(int v) { return v; }
+};
+
+int main()
+{
+#if TEST_STD_VER < 11
+ // expected-no-diagnostics
+#else
+ // expected-error@* 1 {{'pointer_to_unary_function<int, int>' is deprecated}}
+ // expected-error@* 1 {{'pointer_to_binary_function<int, int, int>' is deprecated}}
+ // expected-error@* 1 {{'ptr_fun<int, int>' is deprecated}}
+ // expected-error@* 1 {{'ptr_fun<int, int, int>' is deprecated}}
+
+ // expected-error@* 1 {{'mem_fun_t<int, Foo>' is deprecated}}
+ // expected-error@* 1 {{'mem_fun1_t<int, Foo, int>' is deprecated}}
+ // expected-error@* 1 {{'const_mem_fun_t<int, Foo>' is deprecated}}
+ // expected-error@* 1 {{'const_mem_fun1_t<int, Foo, int>' is deprecated}}
+ // expected-error@* 2 {{'mem_fun<int, Foo>' is deprecated}}
+ // expected-error@* 2 {{'mem_fun<int, Foo, int>' is deprecated}}
+
+ // expected-error@* 1 {{'mem_fun_ref_t<int, Foo>' is deprecated}}
+ // expected-error@* 1 {{'mem_fun1_ref_t<int, Foo, int>' is deprecated}}
+ // expected-error@* 1 {{'const_mem_fun_ref_t<int, Foo>' is deprecated}}
+ // expected-error@* 1 {{'const_mem_fun1_ref_t<int, Foo, int>' is deprecated}}
+ // expected-error@* 2 {{'mem_fun_ref<int, Foo>' is deprecated}}
+ // expected-error@* 2 {{'mem_fun_ref<int, Foo, int>' is deprecated}}
+#endif
+ typedef std::pointer_to_unary_function<int, int> PUF;
+ typedef std::pointer_to_binary_function<int, int, int> PBF;
+ std::ptr_fun<int, int>(identity);
+ std::ptr_fun<int, int, int>(sum);
+
+ typedef std::mem_fun_t<int, Foo> MFT0;
+ typedef std::mem_fun1_t<int, Foo, int> MFT1;
+ typedef std::const_mem_fun_t<int, Foo> CMFT0;
+ typedef std::const_mem_fun1_t<int, Foo, int> CMFT1;
+ std::mem_fun<int, Foo>(&Foo::zero);
+ std::mem_fun<int, Foo, int>(&Foo::identity);
+ std::mem_fun<int, Foo>(&Foo::const_zero);
+ std::mem_fun<int, Foo, int>(&Foo::const_identity);
+
+ typedef std::mem_fun_ref_t<int, Foo> MFR0;
+ typedef std::mem_fun1_ref_t<int, Foo, int> MFR1;
+ typedef std::const_mem_fun_ref_t<int, Foo> CMFR0;
+ typedef std::const_mem_fun1_ref_t<int, Foo, int> CMFR1;
+ std::mem_fun_ref<int, Foo>(&Foo::zero);
+ std::mem_fun_ref<int, Foo, int>(&Foo::identity);
+ std::mem_fun_ref<int, Foo>(&Foo::const_zero);
+ std::mem_fun_ref<int, Foo, int>(&Foo::const_identity);
+}
--- /dev/null
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+//
+// bind1st
+
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+
+#include <functional>
+
+#include "../test_func.h"
+#include "test_macros.h"
+
+int main()
+{
+#if TEST_STD_VER < 11
+ // expected-no-diagnostics
+#else
+ // expected-error@* 1 {{'bind1st<test_func, int>' is deprecated}}
+#endif
+ std::bind1st(test_func(1), 5);
+}
--- /dev/null
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+//
+// bind2nd
+
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+
+#include <functional>
+
+#include "../test_func.h"
+#include "test_macros.h"
+
+int main()
+{
+#if TEST_STD_VER < 11
+ // expected-no-diagnostics
+#else
+ // expected-error@* 1 {{'bind2nd<test_func, int>' is deprecated}}
+#endif
+ std::bind2nd(test_func(1), 5);
+}
--- /dev/null
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+//
+// binder1st
+
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+
+#include <functional>
+
+#include "../test_func.h"
+#include "test_macros.h"
+
+int main()
+{
+#if TEST_STD_VER < 11
+ // expected-no-diagnostics
+#else
+ // expected-error@* 1 {{'binder1st<test_func>' is deprecated}}
+#endif
+ typedef std::binder1st<test_func> B1ST;
+}
--- /dev/null
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+//
+// binder2nd
+
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+
+#include <functional>
+
+#include "../test_func.h"
+#include "test_macros.h"
+
+int main()
+{
+#if TEST_STD_VER < 11
+ // expected-no-diagnostics
+#else
+ // expected-error@* 1 {{'binder2nd<test_func>' is deprecated}}
+#endif
+ typedef std::binder2nd<test_func> B2ND;
+}
--- /dev/null
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// binary_negate
+// deprecated in C++17
+
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+
+#include <functional>
+
+#include "test_macros.h"
+
+struct Predicate {
+ typedef int first_argument_type;
+ typedef int second_argument_type;
+ bool operator()(first_argument_type, second_argument_type) const { return true; }
+};
+
+int main() {
+#if TEST_STD_VER < 17
+ // expected-no-diagnostics
+#else
+ // expected-error@* 1 {{'binary_negate<Predicate>' is deprecated}}
+#endif
+ std::binary_negate<Predicate> f((Predicate()));
+ (void)f;
+}
--- /dev/null
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// not1
+// deprecated in C++17
+
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+
+#include <functional>
+
+#include "test_macros.h"
+
+struct Predicate {
+ typedef int argument_type;
+ bool operator()(argument_type) const { return true; }
+};
+
+int main() {
+#if TEST_STD_VER < 17
+ // expected-no-diagnostics
+#else
+ // expected-error@* 1 {{'not1<Predicate>' is deprecated}}
+#endif
+ std::not1(Predicate());
+}
--- /dev/null
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// not2
+// deprecated in C++17
+
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+
+#include <functional>
+
+#include "test_macros.h"
+
+struct Predicate {
+ typedef int first_argument_type;
+ typedef int second_argument_type;
+ bool operator()(first_argument_type, second_argument_type) const { return true; }
+};
+
+int main() {
+#if TEST_STD_VER < 17
+ // expected-no-diagnostics
+#else
+ // expected-error@* 1 {{'not2<Predicate>' is deprecated}}
+#endif
+ std::not2(Predicate());
+}
--- /dev/null
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// unary_negate
+// deprecated in C++17
+
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+
+#include <functional>
+
+#include "test_macros.h"
+
+struct Predicate {
+ typedef int argument_type;
+ bool operator()(argument_type) const { return true; }
+};
+
+int main() {
+#if TEST_STD_VER < 17
+ // expected-no-diagnostics
+#else
+ // expected-error@* 1 {{'unary_negate<Predicate>' is deprecated}}
+#endif
+ std::unary_negate<Predicate> f((Predicate()));
+ (void)f;
+}