From b7332b04df5d50c92640c74cfeb138ecb7e3f7ae Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Tue, 20 Aug 2019 18:01:01 +0000 Subject: Remove upstream files and directories from vendor/libc++/dist that we do not use. This saves on repository space, and reduces the number of tree conflicts when merging. --- .../func.wrap.func/func.wrap.func.con/F.pass.cpp | 115 ---------- .../func.wrap.func.con/F_assign.pass.cpp | 119 ---------- .../func.wrap.func.con/F_incomplete.pass.cpp | 64 ------ .../func.wrap.func.con/F_nullptr.pass.cpp | 247 --------------------- .../func.wrap.func.con/alloc.fail.cpp | 25 --- .../func.wrap.func.con/alloc.pass.cpp | 30 --- .../func.wrap.func.con/alloc_F.fail.cpp | 29 --- .../func.wrap.func.con/alloc_F.pass.cpp | 130 ----------- .../func.wrap.func.con/alloc_function.fail.cpp | 30 --- .../func.wrap.func.con/alloc_function.pass.cpp | 125 ----------- .../func.wrap.func.con/alloc_nullptr.fail.cpp | 27 --- .../func.wrap.func.con/alloc_nullptr.pass.cpp | 28 --- .../func.wrap.func.con/alloc_rfunction.fail.cpp | 60 ----- .../func.wrap.func.con/alloc_rfunction.pass.cpp | 109 --------- .../func.wrap.func.con/copy_assign.pass.cpp | 138 ------------ .../func.wrap.func.con/copy_move.pass.cpp | 165 -------------- .../func.wrap.func.con/default.pass.cpp | 23 -- .../func.wrap.func.con/move_reentrant.pass.cpp | 46 ---- .../func.wrap.func.con/nullptr_t.pass.cpp | 23 -- .../func.wrap.func.con/nullptr_t_assign.pass.cpp | 72 ------ .../nullptr_t_assign_reentrant.pass.cpp | 46 ---- 21 files changed, 1651 deletions(-) delete mode 100644 test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp delete mode 100644 test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp delete mode 100644 test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_incomplete.pass.cpp delete mode 100644 test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_nullptr.pass.cpp delete mode 100644 test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.fail.cpp delete mode 100644 test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp delete mode 100644 test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.fail.cpp delete mode 100644 test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp delete mode 100644 test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.fail.cpp delete mode 100644 test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp delete mode 100644 test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.fail.cpp delete mode 100644 test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp delete mode 100644 test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.fail.cpp delete mode 100644 test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp delete mode 100644 test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp delete mode 100644 test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp delete mode 100644 test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/default.pass.cpp delete mode 100644 test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/move_reentrant.pass.cpp delete mode 100644 test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t.pass.cpp delete mode 100644 test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign.pass.cpp delete mode 100644 test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign_reentrant.pass.cpp (limited to 'test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con') diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp deleted file mode 100644 index fd296a7367b8..000000000000 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp +++ /dev/null @@ -1,115 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// - -// class function - -// function(F); - -#include -#include - -#include "test_macros.h" -#include "count_new.hpp" - -class A -{ - int data_[10]; -public: - static int count; - - A() - { - ++count; - for (int i = 0; i < 10; ++i) - data_[i] = i; - } - - A(const A&) {++count;} - - ~A() {--count;} - - int operator()(int i) const - { - for (int j = 0; j < 10; ++j) - i += data_[j]; - return i; - } - - int foo(int) const {return 1;} -}; - -int A::count = 0; - -int g(int) {return 0;} - -#if TEST_STD_VER >= 11 -struct RValueCallable { - template - void operator()(Args&&...) && {} -}; -struct LValueCallable { - template - void operator()(Args&&...) & {} -}; -#endif - -int main() -{ - assert(globalMemCounter.checkOutstandingNewEq(0)); - { - std::function f = A(); - assert(A::count == 1); - assert(globalMemCounter.checkOutstandingNewEq(1)); - assert(f.target()); - assert(f.target() == 0); - } - assert(A::count == 0); - assert(globalMemCounter.checkOutstandingNewEq(0)); - { - std::function f = g; - assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(f.target()); - assert(f.target() == 0); - } - assert(globalMemCounter.checkOutstandingNewEq(0)); - { - std::function f = (int (*)(int))0; - assert(!f); - assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(f.target() == 0); - assert(f.target() == 0); - } - { - std::function f = &A::foo; - assert(f); - assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(f.target() != 0); - } - { - std::function f(&g); - assert(f); - assert(f.target() != 0); - f(1); - } - { - std::function f(static_cast(0)); - assert(!f); - } -#if TEST_STD_VER >= 11 - { - using Fn = std::function; - static_assert(std::is_constructible::value, ""); - static_assert(std::is_constructible::value, ""); - static_assert(!std::is_constructible::value, ""); - static_assert(!std::is_constructible::value, ""); - } -#endif -} diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp deleted file mode 100644 index e927ad42c06b..000000000000 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp +++ /dev/null @@ -1,119 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// - -// class function - -// template -// requires CopyConstructible && Callable -// && Convertible::result_type -// operator=(F f); - -#include -#include - -#include "test_macros.h" -#include "count_new.hpp" - -class A -{ - int data_[10]; -public: - static int count; - - A() - { - ++count; - for (int i = 0; i < 10; ++i) - data_[i] = i; - } - - A(const A&) {++count;} - - ~A() {--count;} - - int operator()(int i) const - { - for (int j = 0; j < 10; ++j) - i += data_[j]; - return i; - } - - int foo(int) const {return 1;} -}; - -int A::count = 0; - -int g(int) {return 0;} - -#if TEST_STD_VER >= 11 -struct RValueCallable { - template - void operator()(Args&&...) && {} -}; -struct LValueCallable { - template - void operator()(Args&&...) & {} -}; -#endif - -int main() -{ - assert(globalMemCounter.checkOutstandingNewEq(0)); - { - std::function f; - f = A(); - assert(A::count == 1); - assert(globalMemCounter.checkOutstandingNewEq(1)); - assert(f.target()); - assert(f.target() == 0); - } - assert(A::count == 0); - assert(globalMemCounter.checkOutstandingNewEq(0)); - { - std::function f; - f = g; - assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(f.target()); - assert(f.target() == 0); - } - assert(globalMemCounter.checkOutstandingNewEq(0)); - { - std::function f; - f = (int (*)(int))0; - assert(!f); - assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(f.target() == 0); - assert(f.target() == 0); - } - { - std::function f; - f = &A::foo; - assert(f); - assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(f.target() != 0); - } - { - std::function f; - f = &g; - assert(f); - assert(f.target() != 0); - f(1); - } -#if TEST_STD_VER >= 11 - { - using Fn = std::function; - static_assert(std::is_assignable::value, ""); - static_assert(std::is_assignable::value, ""); - static_assert(!std::is_assignable::value, ""); - static_assert(!std::is_assignable::value, ""); - } -#endif -} diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_incomplete.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_incomplete.pass.cpp deleted file mode 100644 index 75e2ecac3c41..000000000000 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_incomplete.pass.cpp +++ /dev/null @@ -1,64 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// - -// class function - -// template function(F); - -// Allow incomplete argument types in the __is_callable check - -#include -#include - -struct X{ - typedef std::function callback_type; - virtual ~X() {} -private: - callback_type _cb; -}; - -struct IncompleteReturnType { - std::function fn; -}; - - -int called = 0; -IncompleteReturnType test_fn() { - ++called; - IncompleteReturnType I; - return I; -} - -// See llvm.org/PR34298 -void test_pr34298() -{ - static_assert(std::is_copy_constructible::value, ""); - static_assert(std::is_copy_assignable::value, ""); - { - IncompleteReturnType X; - X.fn = test_fn; - const IncompleteReturnType& CX = X; - IncompleteReturnType X2 = CX; - assert(X2.fn); - assert(called == 0); - X2.fn(); - assert(called == 1); - } - { - IncompleteReturnType Empty; - IncompleteReturnType X2 = Empty; - assert(!X2.fn); - } -} - -int main() { - test_pr34298(); -} diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_nullptr.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_nullptr.pass.cpp deleted file mode 100644 index 3affd984af60..000000000000 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_nullptr.pass.cpp +++ /dev/null @@ -1,247 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// - -// class function - -// function(Fp); - -// Ensure that __not_null works for all function types. -// See https://bugs.llvm.org/show_bug.cgi?id=23589 - -//------------------------------------------------------------------------------ -// TESTING std::function<...>::__not_null(Callable) -// -// Concerns: -// 1) The call __not_null(Callable) is well formed and correct for each -// possible 'Callable' type category. These categories include: -// 1a) function pointers -// 1b) member function pointer -// 1c) member data pointer -// 1d) callable class type -// 1e) lambdas -// Categories 1a, 1b, and 1c are 'Nullable' types. Only objects of these -// types can be null. The other categories are not tested here. -// 3) '__not_null(Callable)' is well formed when the call signature includes -// varargs. -// 4) '__not_null(Callable)' works for Callable types with all arities less -// than or equal to 3 in C++03. -// 5) '__not_null(Callable)' works when 'Callable' is a member function -// pointer to a cv or ref qualified function type. -// -// Plan: -// 1 For categories 1a, 1b and 1c define a set of -// 'Callable' objects for this category. This set should include examples -// of arity 0, 1, 2 and possible 3 including versions with varargs as the -// last parameter. -// -// 2 For each 'Callable' object in categories 1a, 1b and 1c do the following. -// -// 1 Define a type 'std::function' as 'F' where 'Sig' is compatible with -// the signature of the 'Callable' object. -// -// 2 Create an object of type 'F' using a null pointer of type 'Callable'. -// Check that 'F.target()' is null. -// -// 3 Create an object of type 'F' that is not null. Check that -// 'F.target()' is not null and is equal to the original -// argument. - -#include -#include -#include - -#include "test_macros.h" - -/////////////////////////////////////////////////////////////////////////////// -int foo() { return 42; } -int foo(int) { return 42; } -int foo(int, int) { return 42; } -int foo(int, int, int) { return 42; } - -int foo(...) { return 42; } -int foo(int, ...) { return 42; } -int foo(int, int, ...) { return 42; } -int foo(int, int, int, ...) { return 42; } - -/////////////////////////////////////////////////////////////////////////////// -struct MemFun03 { - int foo() { return 42; } - int foo() const { return 42; } - int foo() volatile { return 42; } - int foo() const volatile { return 42; } - - int foo(int) { return 42; } - int foo(int) const { return 42; } - int foo(int) volatile { return 42; } - int foo(int) const volatile { return 42; } - - int foo(int, int) { return 42; } - int foo(int, int) const { return 42; } - int foo(int, int) volatile { return 42; } - int foo(int, int) const volatile { return 42; } - - int foo(int, int, int) { return 42; } - int foo(int, int, int) const { return 42; } - int foo(int, int, int) volatile { return 42; } - int foo(int, int, int) const volatile { return 42; } - - int foo(...) { return 42; } - int foo(...) const { return 42; } - int foo(...) volatile { return 42; } - int foo(...) const volatile { return 42; } - - int foo(int, ...) { return 42; } - int foo(int, ...) const { return 42; } - int foo(int, ...) volatile { return 42; } - int foo(int, ...) const volatile { return 42; } - - int foo(int, int, ...) { return 42; } - int foo(int, int, ...) const { return 42; } - int foo(int, int, ...) volatile { return 42; } - int foo(int, int, ...) const volatile { return 42; } - - int foo(int, int, int, ...) { return 42; } - int foo(int, int, int, ...) const { return 42; } - int foo(int, int, int, ...) volatile { return 42; } - int foo(int, int, int, ...) const volatile { return 42; } -}; - -#if TEST_STD_VER >= 11 -struct MemFun11 { - int foo() & { return 42; } - int foo() const & { return 42; } - int foo() volatile & { return 42; } - int foo() const volatile & { return 42; } - - int foo(...) & { return 42; } - int foo(...) const & { return 42; } - int foo(...) volatile & { return 42; } - int foo(...) const volatile & { return 42; } - - int foo() && { return 42; } - int foo() const && { return 42; } - int foo() volatile && { return 42; } - int foo() const volatile && { return 42; } - - int foo(...) && { return 42; } - int foo(...) const && { return 42; } - int foo(...) volatile && { return 42; } - int foo(...) const volatile && { return 42; } -}; -#endif // TEST_STD_VER >= 11 - -struct MemData { - int foo; -}; - -// Create a non-null free function by taking the address of -// &static_cast(foo); -template -struct Creator { - static Tp create() { - return &foo; - } -}; - -// Create a non-null member pointer. -template -struct Creator { - typedef Ret Class::*ReturnType; - static ReturnType create() { - return &Class::foo; - } -}; - -template -void test_imp() { - { // Check that the null value is detected - TestFn tf = nullptr; - std::function f = tf; - assert(f.template target() == nullptr); - } - { // Check that the non-null value is detected. - TestFn tf = Creator::create(); - assert(tf != nullptr); - std::function f = tf; - assert(f.template target() != nullptr); - assert(*f.template target() == tf); - } -} - -void test_func() { - test_imp(); - test_imp(); - test_imp(); - test_imp(); - test_imp(); - test_imp(); - test_imp(); - test_imp(); -} - -void test_mf() { - test_imp(); - test_imp(); - test_imp(); - test_imp(); - test_imp(); - test_imp(); - test_imp(); - test_imp(); - - test_imp(); - test_imp(); - test_imp(); - test_imp(); - test_imp(); - test_imp(); - test_imp(); - test_imp(); - - test_imp(); - test_imp(); - test_imp(); - test_imp(); - test_imp(); - test_imp(); - test_imp(); - test_imp(); - -#if TEST_STD_VER >= 11 - test_imp(); - test_imp(); - test_imp(); - test_imp(); - test_imp(); - test_imp(); - test_imp(); - test_imp(); - - test_imp(); - test_imp(); - test_imp(); - test_imp(); - test_imp(); - test_imp(); - test_imp(); - test_imp(); -#endif -} - -void test_md() { - test_imp(); -} - -int main() { - test_func(); - test_mf(); - test_md(); -} diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.fail.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.fail.cpp deleted file mode 100644 index f455f0311847..000000000000 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// -// XFAIL: c++98, c++03, c++11, c++14 - -// class function - -// template function(allocator_arg_t, const A&); - -#include -#include - -#include "min_allocator.h" - -int main() -{ - std::function f(std::allocator_arg, std::allocator()); -} diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp deleted file mode 100644 index adc7856357e7..000000000000 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// -// REQUIRES: c++98 || c++03 || c++11 || c++14 - -// class function - -// template function(allocator_arg_t, const A&); -// -// This signature was removed in C++17 - -#include -#include - -#include "min_allocator.h" - -int main() -{ - { - std::function f(std::allocator_arg, bare_allocator()); - assert(!f); - } -} diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.fail.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.fail.cpp deleted file mode 100644 index b23153465168..000000000000 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.fail.cpp +++ /dev/null @@ -1,29 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// -// XFAIL: c++98, c++03, c++11, c++14 - -// class function - -// template function(allocator_arg_t, const A&, F); -// -// This signature was removed in C++17 - -#include -#include - -#include "test_macros.h" - -void foo(int) {} - -int main() -{ - std::function f(std::allocator_arg, std::allocator(), foo); -} diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp deleted file mode 100644 index 8a2a12e0f789..000000000000 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp +++ /dev/null @@ -1,130 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// -// REQUIRES: c++98 || c++03 || c++11 || c++14 - -// class function - -// template function(allocator_arg_t, const A&, F); - -#include -#include - -#include "test_macros.h" -#include "min_allocator.h" -#include "test_allocator.h" -#include "count_new.hpp" -#include "../function_types.h" - - -#if TEST_STD_VER >= 11 -struct RValueCallable { - template - void operator()(Args&&...) && {} -}; -struct LValueCallable { - template - void operator()(Args&&...) & {} -}; -#endif - -class DummyClass {}; - -template -void test_FunctionObject(AllocType& alloc) -{ - assert(globalMemCounter.checkOutstandingNewEq(0)); - { - FunctionObject target; - assert(FunctionObject::count == 1); - assert(globalMemCounter.checkOutstandingNewEq(0)); - std::function f2(std::allocator_arg, alloc, target); - assert(FunctionObject::count == 2); - assert(globalMemCounter.checkOutstandingNewEq(1)); - assert(f2.template target()); - assert(f2.template target() == 0); - assert(f2.template target() == 0); - } - assert(FunctionObject::count == 0); - assert(globalMemCounter.checkOutstandingNewEq(0)); -} - - -template -void test_FreeFunction(AllocType& alloc) -{ - assert(globalMemCounter.checkOutstandingNewEq(0)); - { - FuncType* target = &FreeFunction; - assert(globalMemCounter.checkOutstandingNewEq(0)); - std::function f2(std::allocator_arg, alloc, target); - assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(f2.template target()); - assert(*f2.template target() == target); - assert(f2.template target() == 0); - assert(f2.template target() == 0); - } - assert(globalMemCounter.checkOutstandingNewEq(0)); -} - -template -void test_MemFunClass(AllocType& alloc) -{ - assert(globalMemCounter.checkOutstandingNewEq(0)); - { - TargetType target = &MemFunClass::foo; - assert(globalMemCounter.checkOutstandingNewEq(0)); - std::function f2(std::allocator_arg, alloc, target); - assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(f2.template target()); - assert(*f2.template target() == target); - assert(f2.template target() == 0); - } - assert(globalMemCounter.checkOutstandingNewEq(0)); -} - -template -void test_for_alloc(Alloc& alloc) { - test_FunctionObject(alloc); - test_FunctionObject(alloc); - test_FunctionObject(alloc); - test_FunctionObject(alloc); - - test_FreeFunction(alloc); - test_FreeFunction(alloc); - test_FreeFunction(alloc); - test_FreeFunction(alloc); - - test_MemFunClass(alloc); - test_MemFunClass(alloc); - test_MemFunClass(alloc); -} - -int main() -{ - { - bare_allocator bare_alloc; - test_for_alloc(bare_alloc); - } - { - non_default_test_allocator non_default_alloc(42); - test_for_alloc(non_default_alloc); - } -#if TEST_STD_VER >= 11 - { - using Fn = std::function; - static_assert(std::is_constructible, LValueCallable&>::value, ""); - static_assert(std::is_constructible, LValueCallable>::value, ""); - static_assert(!std::is_constructible, RValueCallable&>::value, ""); - static_assert(!std::is_constructible, RValueCallable>::value, ""); - } -#endif - -} diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.fail.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.fail.cpp deleted file mode 100644 index 2e4633b11693..000000000000 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.fail.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// -// XFAIL: c++98, c++03, c++11, c++14 - -// class function - -// template function(allocator_arg_t, const A&, const function&); -// -// This signature was removed in C++17 - - -#include -#include - -#include "test_macros.h" - -int main() -{ - typedef std::function F; - F f1; - F f2(std::allocator_arg, std::allocator(), f1); -} diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp deleted file mode 100644 index 8b0e831287a5..000000000000 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp +++ /dev/null @@ -1,125 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// -// REQUIRES: c++98 || c++03 || c++11 || c++14 - -// class function - -// template function(allocator_arg_t, const A&, const function&); - - -#include -#include - -#include "min_allocator.h" -#include "test_allocator.h" -#include "count_new.hpp" -#include "../function_types.h" - -class DummyClass {}; - -template -void test_FunctionObject(AllocType& alloc) -{ - assert(globalMemCounter.checkOutstandingNewEq(0)); - { - // Construct function from FunctionObject. - std::function f = FunctionObject(); - assert(FunctionObject::count == 1); - assert(globalMemCounter.checkOutstandingNewEq(1)); - assert(f.template target()); - assert(f.template target() == 0); - assert(f.template target() == 0); - // Copy function with allocator - std::function f2(std::allocator_arg, alloc, f); - assert(FunctionObject::count == 2); - assert(globalMemCounter.checkOutstandingNewEq(2)); - assert(f2.template target()); - assert(f2.template target() == 0); - assert(f2.template target() == 0); - } - assert(FunctionObject::count == 0); - assert(globalMemCounter.checkOutstandingNewEq(0)); -} - -template -void test_FreeFunction(AllocType& alloc) -{ - assert(globalMemCounter.checkOutstandingNewEq(0)); - { - // Construct function from function pointer. - FuncType* target = &FreeFunction; - std::function f = target; - assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(f.template target()); - assert(*f.template target() == target); - assert(f.template target() == 0); - // Copy function with allocator - std::function f2(std::allocator_arg, alloc, f); - assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(f2.template target()); - assert(*f2.template target() == target); - assert(f2.template target() == 0); - } - assert(globalMemCounter.checkOutstandingNewEq(0)); -} - -template -void test_MemFunClass(AllocType& alloc) -{ - assert(globalMemCounter.checkOutstandingNewEq(0)); - { - // Construct function from function pointer. - TargetType target = &MemFunClass::foo; - std::function f = target; - assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(f.template target()); - assert(*f.template target() == target); - assert(f.template target() == 0); - // Copy function with allocator - std::function f2(std::allocator_arg, alloc, f); - assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(f2.template target()); - assert(*f2.template target() == target); - assert(f2.template target() == 0); - } - assert(globalMemCounter.checkOutstandingNewEq(0)); -} - -template -void test_for_alloc(Alloc& alloc) -{ - // Large FunctionObject -- Allocation should occur - test_FunctionObject(alloc); - test_FunctionObject(alloc); - test_FunctionObject(alloc); - test_FunctionObject(alloc); - // Free function -- No allocation should occur - test_FreeFunction(alloc); - test_FreeFunction(alloc); - test_FreeFunction(alloc); - test_FreeFunction(alloc); - // Member function -- No allocation should occur. - test_MemFunClass(alloc); - test_MemFunClass(alloc); - test_MemFunClass(alloc); -} - -int main() -{ - { - bare_allocator alloc; - test_for_alloc(alloc); - } - { - non_default_test_allocator alloc(42); - test_for_alloc(alloc); - } -} diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.fail.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.fail.cpp deleted file mode 100644 index cc4ecce75138..000000000000 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.fail.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// -// XFAIL: c++98, c++03, c++11, c++14 - -// class function - -// template function(allocator_arg_t, const A&, nullptr_t); -// -// This signature was removed in C++17 - -#include -#include - -#include "min_allocator.h" - -int main() -{ - std::function f(std::allocator_arg, std::allocator(), nullptr); -} diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp deleted file mode 100644 index 943e170878f2..000000000000 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// -// REQUIRES: c++98 || c++03 || c++11 || c++14 - -// class function - -// template function(allocator_arg_t, const A&, nullptr_t); -// -// This signature was removed in C++17 - -#include -#include - -#include "min_allocator.h" - -int main() -{ - std::function f(std::allocator_arg, bare_allocator(), nullptr); - assert(!f); -} diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.fail.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.fail.cpp deleted file mode 100644 index cb9fb9afad2b..000000000000 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.fail.cpp +++ /dev/null @@ -1,60 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// -// XFAIL: c++98, c++03, c++11, c++14 - -// class function - -// template function(allocator_arg_t, const A&, function&&); -// -// This signature was removed in C++17 - -#include -#include -#include - -#include "test_macros.h" - -class A -{ - int data_[10]; -public: - static int count; - - A() - { - ++count; - for (int i = 0; i < 10; ++i) - data_[i] = i; - } - - A(const A&) {++count;} - - ~A() {--count;} - - int operator()(int i) const - { - for (int j = 0; j < 10; ++j) - i += data_[j]; - return i; - } -}; - -int A::count = 0; - -int g(int) { return 0; } - -int main() -{ - { - std::function f = A(); - std::function f2(std::allocator_arg, std::allocator(), std::move(f)); - } -} diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp deleted file mode 100644 index 3e5435da1a16..000000000000 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp +++ /dev/null @@ -1,109 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03 -// REQUIRES: c++11 || c++14 - -// - -// class function - -// template function(allocator_arg_t, const A&, function&&); -// -// This signature was removed in C++17 - -#include -#include -#include - -#include "test_macros.h" -#include "min_allocator.h" -#include "count_new.hpp" - -class A -{ - int data_[10]; -public: - static int count; - - A() - { - ++count; - for (int i = 0; i < 10; ++i) - data_[i] = i; - } - - A(const A&) {++count;} - - ~A() {--count;} - - int operator()(int i) const - { - for (int j = 0; j < 10; ++j) - i += data_[j]; - return i; - } -}; - -int A::count = 0; - -int g(int) { return 0; } - -int main() -{ - assert(globalMemCounter.checkOutstandingNewEq(0)); - { - std::function f = A(); - assert(A::count == 1); - assert(globalMemCounter.checkOutstandingNewEq(1)); - assert(f.target()); - assert(f.target() == 0); - std::function f2(std::allocator_arg, bare_allocator(), std::move(f)); - assert(A::count == 1); - assert(globalMemCounter.checkOutstandingNewEq(1)); - assert(f2.target()); - assert(f2.target() == 0); - assert(f.target() == 0); - assert(f.target() == 0); - } - assert(globalMemCounter.checkOutstandingNewEq(0)); - { - // Test that moving a function constructed from a reference wrapper - // is done without allocating. - DisableAllocationGuard g; - using Ref = std::reference_wrapper; - A a; - Ref aref(a); - std::function f(aref); - assert(A::count == 1); - assert(f.target() == nullptr); - assert(f.target()); - std::function f2(std::allocator_arg, std::allocator{}, - std::move(f)); - assert(A::count == 1); - assert(f2.target() == nullptr); - assert(f2.target()); - assert(f.target()); // f is unchanged because the target is small - } - { - // Test that moving a function constructed from a function pointer - // is done without allocating - DisableAllocationGuard guard; - using Ptr = int(*)(int); - Ptr p = g; - std::function f(p); - assert(f.target() == nullptr); - assert(f.target()); - std::function f2(std::allocator_arg, std::allocator(), - std::move(f)); - assert(f2.target() == nullptr); - assert(f2.target()); - assert(f.target()); // f is unchanged because the target is small - } -} diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp deleted file mode 100644 index 1c2be02c6212..000000000000 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp +++ /dev/null @@ -1,138 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// - -// class function - -// function& operator=(const function& f); - -#include -#include - -#include "test_macros.h" -#include "count_new.hpp" - -class A { - int data_[10]; - -public: - static int count; - - A() { - ++count; - for (int i = 0; i < 10; ++i) - data_[i] = i; - } - - A(const A &) { ++count; } - - ~A() { --count; } - - int operator()(int i) const { - for (int j = 0; j < 10; ++j) - i += data_[j]; - return i; - } -}; - -int A::count = 0; - -int g0() { return 0; } -int g(int) { return 0; } -int g2(int, int) { return 2; } -int g3(int, int, int) { return 3; } - -int main() { - assert(globalMemCounter.checkOutstandingNewEq(0)); - { - std::function f = A(); - assert(A::count == 1); - assert(globalMemCounter.checkOutstandingNewEq(1)); - assert(f.target()); - assert(f.target() == 0); - std::function f2; - f2 = f; - assert(A::count == 2); - assert(globalMemCounter.checkOutstandingNewEq(2)); - assert(f2.target()); - assert(f2.target() == 0); - } - assert(A::count == 0); - assert(globalMemCounter.checkOutstandingNewEq(0)); - { - std::function f = g; - assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(f.target()); - assert(f.target() == 0); - std::function f2; - f2 = f; - assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(f2.target()); - assert(f2.target() == 0); - } - assert(globalMemCounter.checkOutstandingNewEq(0)); - { - std::function f; - assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(f.target() == 0); - assert(f.target() == 0); - std::function f2; - f2 = f; - assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(f2.target() == 0); - assert(f2.target() == 0); - } - { - typedef std::function Func; - Func f = g0; - Func& fr = (f = (Func &)f); - assert(&fr == &f); - assert(*f.target() == g0); - } - { - typedef std::function Func; - Func f = g; - Func& fr = (f = (Func &)f); - assert(&fr == &f); - assert(*f.target() == g); - } - { - typedef std::function Func; - Func f = g2; - Func& fr = (f = (Func &)f); - assert(&fr == &f); - assert(*f.target() == g2); - } - { - typedef std::function Func; - Func f = g3; - Func& fr = (f = (Func &)f); - assert(&fr == &f); - assert(*f.target() == g3); - } -#if TEST_STD_VER >= 11 - assert(globalMemCounter.checkOutstandingNewEq(0)); - { - std::function f = A(); - assert(A::count == 1); - assert(globalMemCounter.checkOutstandingNewEq(1)); - assert(f.target()); - assert(f.target() == 0); - std::function f2; - f2 = std::move(f); - assert(A::count == 1); - assert(globalMemCounter.checkOutstandingNewEq(1)); - assert(f2.target()); - assert(f2.target() == 0); - assert(f.target() == 0); - assert(f.target() == 0); - } -#endif -} diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp deleted file mode 100644 index e9b399a2edd2..000000000000 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp +++ /dev/null @@ -1,165 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// - -// class function - -// function(const function& f); -// function(function&& f); // noexcept in C++20 - -#include -#include -#include -#include - -#include "test_macros.h" -#include "count_new.hpp" - -class A -{ - int data_[10]; -public: - static int count; - - A() - { - ++count; - for (int i = 0; i < 10; ++i) - data_[i] = i; - } - - A(const A&) {++count;} - - ~A() {--count;} - - int operator()(int i) const - { - for (int j = 0; j < 10; ++j) - i += data_[j]; - return i; - } -}; - -int A::count = 0; - -int g(int) {return 0;} - -int main() -{ - assert(globalMemCounter.checkOutstandingNewEq(0)); - { - std::function f = A(); - assert(A::count == 1); - assert(globalMemCounter.checkOutstandingNewEq(1)); - assert(f.target()); - assert(f.target() == 0); - std::function f2 = f; - assert(A::count == 2); - assert(globalMemCounter.checkOutstandingNewEq(2)); - assert(f2.target()); - assert(f2.target() == 0); - } - assert(A::count == 0); - assert(globalMemCounter.checkOutstandingNewEq(0)); - { - std::function f = g; - assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(f.target()); - assert(f.target() == 0); - std::function f2 = f; - assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(f2.target()); - assert(f2.target() == 0); - } - assert(globalMemCounter.checkOutstandingNewEq(0)); - { - std::function f; - assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(f.target() == 0); - assert(f.target() == 0); - std::function f2 = f; - assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(f2.target() == 0); - assert(f2.target() == 0); - } - { - std::function f; - assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(f.target() == 0); - assert(f.target() == 0); - assert(!f); - std::function g = f; - assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(g.target() == 0); - assert(g.target() == 0); - assert(!g); - } -#if TEST_STD_VER >= 11 - assert(globalMemCounter.checkOutstandingNewEq(0)); - { // Test rvalue references - std::function f = A(); - assert(A::count == 1); - assert(globalMemCounter.checkOutstandingNewEq(1)); - assert(f.target()); - assert(f.target() == 0); - LIBCPP_ASSERT_NOEXCEPT(std::function(std::move(f))); -#if TEST_STD_VER > 17 - ASSERT_NOEXCEPT(std::function(std::move(f))); -#endif - std::function f2 = std::move(f); - assert(A::count == 1); - assert(globalMemCounter.checkOutstandingNewEq(1)); - assert(f2.target()); - assert(f2.target() == 0); - assert(f.target() == 0); - assert(f.target() == 0); - } - assert(globalMemCounter.checkOutstandingNewEq(0)); - { - // Test that moving a function constructed from a reference wrapper - // is done without allocating. - DisableAllocationGuard g; - using Ref = std::reference_wrapper; - A a; - Ref aref(a); - std::function f(aref); - assert(A::count == 1); - assert(f.target() == nullptr); - assert(f.target()); - LIBCPP_ASSERT_NOEXCEPT(std::function(std::move(f))); -#if TEST_STD_VER > 17 - ASSERT_NOEXCEPT(std::function(std::move(f))); -#endif - std::function f2(std::move(f)); - assert(A::count == 1); - assert(f2.target() == nullptr); - assert(f2.target()); - LIBCPP_ASSERT(f.target()); // f is unchanged because the target is small - } - { - // Test that moving a function constructed from a function pointer - // is done without allocating - DisableAllocationGuard guard; - using Ptr = int(*)(int); - Ptr p = g; - std::function f(p); - assert(f.target() == nullptr); - assert(f.target()); - LIBCPP_ASSERT_NOEXCEPT(std::function(std::move(f))); -#if TEST_STD_VER > 17 - ASSERT_NOEXCEPT(std::function(std::move(f))); -#endif - std::function f2(std::move(f)); - assert(f2.target() == nullptr); - assert(f2.target()); - LIBCPP_ASSERT(f.target()); // f is unchanged because the target is small - } -#endif // TEST_STD_VER >= 11 -} diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/default.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/default.pass.cpp deleted file mode 100644 index 83d61b6b2d89..000000000000 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/default.pass.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// - -// class function - -// explicit function(); - -#include -#include - -int main() -{ - std::function f; - assert(!f); -} diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/move_reentrant.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/move_reentrant.pass.cpp deleted file mode 100644 index 0813c48f322e..000000000000 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/move_reentrant.pass.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// - -// class function - -// function& operator=(function &&); - -#include -#include - -#include "test_macros.h" - -struct A -{ - static std::function global; - static bool cancel; - - ~A() { - DoNotOptimize(cancel); - if (cancel) - global = std::function(nullptr); - } - void operator()() {} -}; - -std::function A::global; -bool A::cancel = false; - -int main() -{ - A::global = A(); - assert(A::global.target()); - - // Check that we don't recurse in A::~A(). - A::cancel = true; - A::global = std::function(nullptr); - assert(!A::global.target()); -} diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t.pass.cpp deleted file mode 100644 index f0d6402d185e..000000000000 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t.pass.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// - -// class function - -// function(nullptr_t); - -#include -#include - -int main() -{ - std::function f(nullptr); - assert(!f); -} diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign.pass.cpp deleted file mode 100644 index 9b2482fb9d54..000000000000 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign.pass.cpp +++ /dev/null @@ -1,72 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// - -// class function - -// function& operator=(nullptr_t); - -#include -#include - -#include "count_new.hpp" - -class A -{ - int data_[10]; -public: - static int count; - - A() - { - ++count; - for (int i = 0; i < 10; ++i) - data_[i] = i; - } - - A(const A&) {++count;} - - ~A() {--count;} - - int operator()(int i) const - { - for (int j = 0; j < 10; ++j) - i += data_[j]; - return i; - } -}; - -int A::count = 0; - -int g(int) {return 0;} - -int main() -{ - assert(globalMemCounter.checkOutstandingNewEq(0)); - { - std::function f = A(); - assert(A::count == 1); - assert(globalMemCounter.checkOutstandingNewEq(1)); - assert(f.target()); - f = nullptr; - assert(A::count == 0); - assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(f.target() == 0); - } - { - std::function f = g; - assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(f.target()); - assert(f.target() == 0); - f = nullptr; - assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(f.target() == 0); - } -} diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign_reentrant.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign_reentrant.pass.cpp deleted file mode 100644 index eeb181928eaf..000000000000 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign_reentrant.pass.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// - -// class function - -// function& operator=(nullptr_t); - -#include -#include - -#include "test_macros.h" - -struct A -{ - static std::function global; - static bool cancel; - - ~A() { - DoNotOptimize(cancel); - if (cancel) - global = nullptr; - } - void operator()() {} -}; - -std::function A::global; -bool A::cancel = false; - -int main() -{ - A::global = A(); - assert(A::global.target()); - - // Check that we don't recurse in A::~A(). - A::cancel = true; - A::global = nullptr; - assert(!A::global.target()); -} -- cgit v1.3