diff options
Diffstat (limited to 'libcxx/test/std/utilities/function.objects')
4 files changed, 148 insertions, 0 deletions
diff --git a/libcxx/test/std/utilities/function.objects/negators/binary_negate.depr_in_cxx17.fail.cpp b/libcxx/test/std/utilities/function.objects/negators/binary_negate.depr_in_cxx17.fail.cpp new file mode 100644 index 00000000000..6ad3f7f3117 --- /dev/null +++ b/libcxx/test/std/utilities/function.objects/negators/binary_negate.depr_in_cxx17.fail.cpp @@ -0,0 +1,38 @@ +//===----------------------------------------------------------------------===// +// +// 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; +} diff --git a/libcxx/test/std/utilities/function.objects/negators/not1.depr_in_cxx17.fail.cpp b/libcxx/test/std/utilities/function.objects/negators/not1.depr_in_cxx17.fail.cpp new file mode 100644 index 00000000000..a2f7f65b1c4 --- /dev/null +++ b/libcxx/test/std/utilities/function.objects/negators/not1.depr_in_cxx17.fail.cpp @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// 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()); +} diff --git a/libcxx/test/std/utilities/function.objects/negators/not2.depr_in_cxx17.fail.cpp b/libcxx/test/std/utilities/function.objects/negators/not2.depr_in_cxx17.fail.cpp new file mode 100644 index 00000000000..a858014596e --- /dev/null +++ b/libcxx/test/std/utilities/function.objects/negators/not2.depr_in_cxx17.fail.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// 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()); +} diff --git a/libcxx/test/std/utilities/function.objects/negators/unary_negate.depr_in_cxx17.fail.cpp b/libcxx/test/std/utilities/function.objects/negators/unary_negate.depr_in_cxx17.fail.cpp new file mode 100644 index 00000000000..3df852166fe --- /dev/null +++ b/libcxx/test/std/utilities/function.objects/negators/unary_negate.depr_in_cxx17.fail.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// 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; +} |