Fix a couple of failing tests for C++03 by checking for rvalue reference support first.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220465 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3de9baafba
commit
9b82e151fe
@ -55,8 +55,10 @@ int C::count = 0;
|
|||||||
template <class T>
|
template <class T>
|
||||||
std::weak_ptr<T> source (std::shared_ptr<T> p) { return std::weak_ptr<T>(p); }
|
std::weak_ptr<T> source (std::shared_ptr<T> p) { return std::weak_ptr<T>(p); }
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
template <class T>
|
template <class T>
|
||||||
void sink (std::weak_ptr<T> &&) {}
|
void sink (std::weak_ptr<T> &&) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
@ -98,6 +100,7 @@ int main()
|
|||||||
assert(B::count == 0);
|
assert(B::count == 0);
|
||||||
assert(A::count == 0);
|
assert(A::count == 0);
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
{
|
{
|
||||||
std::shared_ptr<A> ps(new A);
|
std::shared_ptr<A> ps(new A);
|
||||||
std::weak_ptr<A> pA = source(ps);
|
std::weak_ptr<A> pA = source(ps);
|
||||||
@ -107,4 +110,5 @@ int main()
|
|||||||
}
|
}
|
||||||
assert(B::count == 0);
|
assert(B::count == 0);
|
||||||
assert(A::count == 0);
|
assert(A::count == 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -55,9 +55,6 @@ int C::count = 0;
|
|||||||
template <class T>
|
template <class T>
|
||||||
std::weak_ptr<T> source (std::shared_ptr<T> p) { return std::weak_ptr<T>(p); }
|
std::weak_ptr<T> source (std::shared_ptr<T> p) { return std::weak_ptr<T>(p); }
|
||||||
|
|
||||||
template <class T>
|
|
||||||
void sink (std::weak_ptr<T> &&) {}
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
static_assert(( std::is_convertible<std::weak_ptr<A>, std::weak_ptr<B> >::value), "");
|
static_assert(( std::is_convertible<std::weak_ptr<A>, std::weak_ptr<B> >::value), "");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user