Remove all instances of _LIBCPP_HAS_NO_RVALUE_REFERENCES from test/std/utilities

llvm-svn: 283032
This commit is contained in:
Eric Fiselier 2016-10-01 10:46:01 +00:00
parent 341e47891b
commit 2c8c71f13e
45 changed files with 118 additions and 209 deletions

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@ -23,8 +25,6 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::scoped_allocator_adaptor<A1<int>> A;
A1<int> a3(3);
@ -108,5 +108,4 @@ int main()
std::scoped_allocator_adaptor<A2<int>, A3<int>>(A2<int>(5), A3<int>(6))));
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@ -23,8 +25,6 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::scoped_allocator_adaptor<A1<double>> B;
typedef std::scoped_allocator_adaptor<A1<int>> A;
@ -65,5 +65,4 @@ int main()
assert(a2 == a1);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@ -23,8 +25,6 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::scoped_allocator_adaptor<A1<double>> B;
typedef std::scoped_allocator_adaptor<A1<int>> A;
@ -70,6 +70,4 @@ int main()
assert(A3<int>::move_called == true);
assert(a2 == a1);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@ -21,8 +23,6 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::scoped_allocator_adaptor<A1<int>> A;
A a1(A1<int>(3));
@ -65,6 +65,4 @@ int main()
assert(A3<int>::move_called == false);
assert(a2 == a1);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@ -21,8 +23,6 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::scoped_allocator_adaptor<A1<int>> A;
A a;
@ -54,5 +54,4 @@ int main()
assert(A3<int>::move_called == false);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@ -21,8 +23,6 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::scoped_allocator_adaptor<A1<int>> A;
A a;
@ -45,5 +45,4 @@ int main()
assert(A1<int>::allocate_called == true);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@ -21,8 +23,6 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::scoped_allocator_adaptor<A1<int>> A;
A a;
@ -66,5 +66,4 @@ int main()
assert(a.allocate(10, (const void*)20) == (int*)20);
assert(A2<int>::allocate_called == true);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@ -20,8 +22,6 @@
#include "allocators.h"
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
struct B
{
static bool constructed;
@ -111,11 +111,8 @@ struct F
bool F::constructed = false;
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::scoped_allocator_adaptor<A1<std::string>> A;
@ -188,6 +185,4 @@ int main()
assert(A3<F>::constructed);
s->~S();
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@ -21,7 +23,6 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::scoped_allocator_adaptor<A1<int>> A;
@ -42,5 +43,4 @@ int main()
assert((A1<int>::deallocate_called == std::pair<int*, std::size_t>((int*)10, 20)));
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@ -32,8 +34,6 @@ bool B::constructed = false;
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::scoped_allocator_adaptor<A1<B>> A;
A a;
@ -66,5 +66,4 @@ int main()
assert(A3<S>::destroy_called);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@ -22,8 +24,6 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::scoped_allocator_adaptor<A1<int>> A;
A a(A1<int>(5));
@ -41,5 +41,4 @@ int main()
std::scoped_allocator_adaptor<A2<int>, A3<int>>(A2<int>(6), A3<int>(8))));
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@ -21,8 +23,6 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::scoped_allocator_adaptor<A1<int>> A;
const A a(A1<int>(100));
@ -39,5 +39,4 @@ int main()
assert(a.max_size() == 200);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@ -22,7 +24,6 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::scoped_allocator_adaptor<A1<int>> A;
@ -39,6 +40,4 @@ int main()
A a(A1<int>(5), A2<int>(6), A3<int>(8));
assert(a.outer_allocator() == A1<int>(5));
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@ -21,8 +23,6 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::scoped_allocator_adaptor<A1<int>> A;
A a1(A1<int>(3));
@ -51,5 +51,4 @@ int main()
assert(a2.inner_allocator().inner_allocator().outer_allocator().id() == -1);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@ -21,8 +23,6 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
static_assert((std::is_same<
std::scoped_allocator_adaptor<A1<int>>::inner_allocator_type,
std::scoped_allocator_adaptor<A1<int>>>::value), "");
@ -34,6 +34,4 @@ int main()
static_assert((std::is_same<
std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>>::inner_allocator_type,
std::scoped_allocator_adaptor<A2<int>, A3<int>>>::value), "");
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@ -22,8 +24,6 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
// sanity checks
static_assert( (std::is_same<
std::allocator_traits<A1<int>>::is_always_equal, std::false_type>::value
@ -69,7 +69,4 @@ int main()
std::allocator_traits<A2<int>>::is_always_equal::value &&
std::allocator_traits<A3<int>>::is_always_equal::value)
), "");
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@ -21,8 +23,6 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
static_assert((std::is_same<
std::scoped_allocator_adaptor<A1<int>>::propagate_on_container_copy_assignment,
std::false_type>::value), "");
@ -35,5 +35,4 @@ int main()
std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>>::propagate_on_container_copy_assignment,
std::true_type>::value), "");
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@ -21,8 +23,6 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
static_assert((std::is_same<
std::scoped_allocator_adaptor<A1<int>>::propagate_on_container_move_assignment,
std::false_type>::value), "");
@ -35,5 +35,4 @@ int main()
std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>>::propagate_on_container_move_assignment,
std::true_type>::value), "");
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@ -21,8 +23,6 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
static_assert((std::is_same<
std::scoped_allocator_adaptor<A1<int>>::propagate_on_container_swap,
std::false_type>::value), "");
@ -34,6 +34,4 @@ int main()
static_assert((std::is_same<
std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>>::propagate_on_container_swap,
std::true_type>::value), "");
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@ -22,7 +24,6 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::scoped_allocator_adaptor<A1<int>> A;
A a1(A1<int>(3));
@ -68,5 +69,4 @@ int main()
assert(A3<int>::move_called == false);
assert(aN == a1);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@ -29,8 +31,6 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::scoped_allocator_adaptor<A1<int>> A;
A a1(A1<int>(3));
@ -59,6 +59,4 @@ int main()
assert(a2 != a1);
assert(!(a2 == a1));
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@ -22,7 +24,6 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::scoped_allocator_adaptor<A1<int>> A;
A a1(A1<int>(3));
@ -68,5 +69,4 @@ int main()
assert(A3<int>::move_called == true);
assert(aN == a1);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@ -30,8 +32,6 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
static_assert((std::is_base_of<
A1<int>,
std::scoped_allocator_adaptor<A1<int>>
@ -97,6 +97,4 @@ int main()
static_assert((std::is_same<
std::scoped_allocator_adaptor<A2<int>, A1<int>>::const_void_pointer,
const void*>::value), "");
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -16,6 +16,7 @@
#include <functional>
#include <cassert>
#include "test_macros.h"
#include "count_new.hpp"
class A
@ -88,7 +89,7 @@ int main()
assert(f2.target<int(*)(int)>() == 0);
assert(f2.target<A>() == 0);
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if TEST_STD_VER >= 11
assert(globalMemCounter.checkOutstandingNewEq(0));
{
std::function<int(int)> f = A();
@ -105,5 +106,5 @@ int main()
assert(f.target<A>() == 0);
assert(f.target<int(*)(int)>() == 0);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
}

View File

@ -21,7 +21,9 @@
#include <type_traits>
#include <string>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include "test_macros.h"
#if TEST_STD_VER >= 11
class MoveOnly
{
MoveOnly(const MoveOnly&);
@ -55,7 +57,7 @@ int main()
test<int>();
test<double>();
test<std::string>();
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if TEST_STD_VER >= 11
test<MoveOnly>();
#endif
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// unique_ptr
@ -46,17 +48,10 @@ template <class T>
class Deleter
{
int state_;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Deleter(const Deleter&);
Deleter& operator=(const Deleter&);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Deleter(Deleter&);
Deleter& operator=(Deleter&);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
Deleter& operator=(Deleter&& r)
{
@ -64,20 +59,9 @@ public:
r.state_ = 0;
return *this;
}
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
Deleter& operator=(std::__rv<Deleter> r)
{
state_ = r->state_;
r->state_ = 0;
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Deleter() : state_(5) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class U>
Deleter(Deleter<U>&& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
@ -87,12 +71,7 @@ private:
template <class U>
Deleter(const Deleter<U>& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class U>
Deleter(Deleter<U> d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
: state_(d.state()) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
public:
int state() const {return state_;}
void set_state(int i) {state_ = i;}
@ -102,17 +81,6 @@ public:
int main()
{
{
const std::unique_ptr<B, Deleter<B> > s(new B);
A* p = s.get();
std::unique_ptr<A, Deleter<A> > s2(s);
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
assert(B::count == 1);
assert(s2.get_deleter().state() == 5);
assert(s.get_deleter().state() == 0);
}
assert(A::count == 0);
assert(B::count == 0);
const std::unique_ptr<B, Deleter<B> > s;
std::unique_ptr<A, Deleter<A> > s2(s); // expected-error {{no matching constructor}}
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// unique_ptr
@ -47,16 +49,9 @@ class Deleter
{
int state_;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Deleter(const Deleter&);
Deleter& operator=(const Deleter&);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Deleter(Deleter&);
Deleter& operator=(Deleter&);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
Deleter& operator=(Deleter&& r)
{
@ -64,20 +59,9 @@ public:
r.state_ = 0;
return *this;
}
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
Deleter& operator=(std::__rv<Deleter> r)
{
state_ = r->state_;
r->state_ = 0;
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Deleter() : state_(5) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class U>
Deleter(Deleter<U>&& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
@ -87,12 +71,7 @@ private:
template <class U>
Deleter(const Deleter<U>& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class U>
Deleter(Deleter<U> d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
: state_(d.state()) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
public:
int state() const {return state_;}
void set_state(int i) {state_ = i;}
@ -102,17 +81,6 @@ public:
int main()
{
{
const std::unique_ptr<B, Deleter<B> > s(new B);
A* p = s.get();
std::unique_ptr<A, Deleter<A> > s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
assert(B::count == 1);
assert(s2.get_deleter().state() == 5);
assert(s.get_deleter().state() == 0);
}
assert(A::count == 0);
assert(B::count == 0);
const std::unique_ptr<B, Deleter<B> > s;
std::unique_ptr<A, Deleter<A> > s2 = s; // expected-error {{no viable conversion}}
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// shared_ptr
@ -42,7 +44,6 @@ int A::count = 0;
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::shared_ptr<A> pA(new A);
A* ptrA = pA.get();
@ -119,5 +120,4 @@ int main()
}
assert(B::count == 0);
assert(A::count == 0);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// shared_ptr
@ -42,7 +44,6 @@ int A::count = 0;
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::shared_ptr<A> pA(new A);
A* ptrA = pA.get();
@ -119,5 +120,4 @@ int main()
}
assert(B::count == 0);
assert(A::count == 0);
#endif // _LIBCXX_HAS_NO_RVALUE_REFERENCES
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// shared_ptr
@ -17,6 +19,8 @@
#include <type_traits>
#include <cassert>
#include "test_macros.h"
struct B
{
static int count;
@ -66,24 +70,24 @@ int main()
std::shared_ptr<B> pB(std::move(pA));
assert(B::count == 1);
assert(A::count == 1);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if TEST_STD_VER >= 11
assert(pB.use_count() == 1);
assert(pA.use_count() == 0);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#else
assert(pB.use_count() == 2);
assert(pA.use_count() == 2);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
assert(p == pB.get());
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if TEST_STD_VER >= 11
assert(pA.use_count() == 0);
assert(B::count == 0);
assert(A::count == 0);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#else
assert(pA.use_count() == 1);
assert(B::count == 1);
assert(A::count == 1);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
}
assert(B::count == 0);
assert(A::count == 0);

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// shared_ptr
@ -16,6 +18,8 @@
#include <memory>
#include <cassert>
#include "test_macros.h"
struct A
{
static int count;
@ -37,22 +41,22 @@ int main()
A* p = pA.get();
std::shared_ptr<A> pA2(std::move(pA));
assert(A::count == 1);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if TEST_STD_VER >= 11
assert(pA.use_count() == 0);
assert(pA2.use_count() == 1);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#else
assert(pA.use_count() == 2);
assert(pA2.use_count() == 2);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
assert(pA2.get() == p);
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if TEST_STD_VER >= 11
assert(pA.use_count() == 0);
assert(A::count == 0);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#else
assert(pA.use_count() == 1);
assert(A::count == 1);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
}
assert(A::count == 0);
{

View File

@ -16,6 +16,7 @@
#include <memory>
#include <cassert>
#include "test_macros.h"
#include "count_new.hpp"
struct A
@ -65,7 +66,7 @@ int main()
assert(p2.get());
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if TEST_STD_VER >= 11
nc = globalMemCounter.outstanding_new;
{
char c = 'e';

View File

@ -18,6 +18,8 @@
#include <type_traits>
#include <cassert>
#include "test_macros.h"
struct B
{
static int count;
@ -55,7 +57,7 @@ int C::count = 0;
template <class T>
std::weak_ptr<T> source (std::shared_ptr<T> p) { return std::weak_ptr<T>(p); }
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if TEST_STD_VER >= 11
template <class T>
void sink (std::weak_ptr<T> &&) {}
#endif
@ -100,7 +102,7 @@ int main()
assert(B::count == 0);
assert(A::count == 0);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if TEST_STD_VER >= 11
{
std::shared_ptr<A> ps(new A);
std::weak_ptr<A> pA = source(ps);

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// type_traits
// add_rvalue_reference
@ -16,8 +18,6 @@
#include <type_traits>
#include "test_macros.h"
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class T, class U>
void test_add_rvalue_reference()
{
@ -44,13 +44,11 @@ void test_function1()
static_assert((std::is_same<std::add_rvalue_reference_t<F>, F>::value), "");
#endif
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
struct Foo {};
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
test_add_rvalue_reference<void, void>();
test_add_rvalue_reference<int, int&&>();
test_add_rvalue_reference<int[3], int(&&)[3]>();
@ -63,22 +61,17 @@ int main()
// LWG 2101 specifically talks about add_rvalue_reference and functions.
// The term of art is "a referenceable type", which a cv- or ref-qualified function is not.
test_function0<void()>();
#if TEST_STD_VER >= 11
test_function1<void() const>();
test_function1<void() &>();
test_function1<void() &&>();
test_function1<void() const &>();
test_function1<void() const &&>();
#endif
// But a cv- or ref-qualified member function *is* "a referenceable type"
test_function0<void (Foo::*)()>();
#if TEST_STD_VER >= 11
test_function0<void (Foo::*)() const>();
test_function0<void (Foo::*)() &>();
test_function0<void (Foo::*)() &&>();
test_function0<void (Foo::*)() const &>();
test_function0<void (Foo::*)() const &&>();
#endif
#endif
}

View File

@ -37,11 +37,11 @@ int main()
test_remove_reference<int*&, int*>();
test_remove_reference<const int*&, const int*>();
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if TEST_STD_VER >= 11
test_remove_reference<int&&, int>();
test_remove_reference<const int&&, const int>();
test_remove_reference<int(&&)[3], int[3]>();
test_remove_reference<int*&&, int*>();
test_remove_reference<const int*&&, const int*>();
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// type_traits
// rvalue_ref
@ -39,11 +41,9 @@ struct incomplete_type;
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
test_rvalue_ref<int&&>();
test_rvalue_ref<const int&&>();
// LWG#2582
static_assert(!std::is_rvalue_reference<incomplete_type>::value, "");
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// type_traits
// rvalue_ref
@ -27,8 +29,6 @@ void test_rvalue_ref()
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
test_rvalue_ref<int&&>();
test_rvalue_ref<const int&&>();
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -74,12 +74,10 @@ int main()
test_is_copy_assignable<NotEmpty> ();
test_is_copy_assignable<Empty> ();
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if TEST_STD_VER >= 11
test_is_not_copy_assignable<const int> ();
test_is_not_copy_assignable<int[]> ();
test_is_not_copy_assignable<int[3]> ();
#endif
#if TEST_STD_VER >= 11
test_is_not_copy_assignable<B> ();
#endif
test_is_not_copy_assignable<void> ();

View File

@ -63,7 +63,7 @@ int main()
test_is_move_assignable<NotEmpty> ();
test_is_move_assignable<Empty> ();
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if TEST_STD_VER >= 11
test_is_not_move_assignable<const int> ();
test_is_not_move_assignable<int[]> ();
test_is_not_move_assignable<int[3]> ();

View File

@ -62,7 +62,7 @@ struct A
struct B
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if TEST_STD_VER >= 11
B(B&&);
#endif
};

View File

@ -50,7 +50,7 @@ int main()
{
test_is_nothrow_assignable<int&, int&> ();
test_is_nothrow_assignable<int&, int> ();
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if TEST_STD_VER >= 11
test_is_nothrow_assignable<int&, double> ();
#endif

View File

@ -92,7 +92,7 @@ struct C
void operator=(C&); // not const
};
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if TEST_STD_VER >= 11
struct Tuple {
Tuple(Empty&&) noexcept {}
};
@ -104,15 +104,14 @@ int main()
test_is_nothrow_constructible<int, const int&> ();
test_is_nothrow_constructible<Empty> ();
test_is_nothrow_constructible<Empty, const Empty&> ();
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
test_is_nothrow_constructible<Tuple &&, Empty> (); // See bug #19616.
#endif
test_is_not_nothrow_constructible<A, int> ();
test_is_not_nothrow_constructible<A, int, double> ();
test_is_not_nothrow_constructible<A> ();
test_is_not_nothrow_constructible<C> ();
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if TEST_STD_VER >= 11
test_is_nothrow_constructible<Tuple &&, Empty> (); // See bug #19616.
static_assert(!std::is_constructible<Tuple&, Empty>::value, "");
test_is_not_nothrow_constructible<Tuple &, Empty> (); // See bug #19616.
#endif

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <utility>
// template <class T1, class T2> struct pair
@ -21,12 +23,10 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::pair<std::unique_ptr<int>, short> P;
P p(std::unique_ptr<int>(new int(3)), 4);
std::unique_ptr<int> ptr = std::get<0>(std::move(p));
assert(*ptr == 3);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <utility>
// template <class T1, class T2> struct pair
@ -29,7 +31,6 @@ struct Derived
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::pair<std::unique_ptr<Derived>, short> P1;
typedef std::pair<std::unique_ptr<Base>, long> P2;
@ -39,5 +40,4 @@ int main()
assert(p2.first == nullptr);
assert(p2.second == 4);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -15,6 +15,8 @@
#include <memory>
#include <cassert>
#include "test_macros.h"
int main()
{
{
@ -24,7 +26,7 @@ int main()
assert(p1.second == 4);
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if TEST_STD_VER >= 11
{
typedef std::pair<std::unique_ptr<int>, short> P1;
P1 p1 = std::make_pair(std::unique_ptr<int>(new int(3)), 4);
@ -37,9 +39,8 @@ int main()
assert(p1.first == nullptr);
assert(p1.second == 4);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if _LIBCPP_STD_VER > 11
#endif
#if TEST_STD_VER >= 14
{
typedef std::pair<int, short> P1;
constexpr P1 p1 = std::make_pair(3, 4);