diff --git a/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_Y_rv.pass.cpp b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_Y_rv.pass.cpp
index b670dde6..93956bca 100644
--- a/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_Y_rv.pass.cpp
+++ b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_Y_rv.pass.cpp
@@ -42,6 +42,7 @@ int A::count = 0;
int main()
{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::shared_ptr pA(new A);
A* ptrA = pA.get();
@@ -118,4 +119,5 @@ int main()
}
assert(B::count == 0);
assert(A::count == 0);
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_rv.pass.cpp b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_rv.pass.cpp
index 50a15b47..4194890d 100644
--- a/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_rv.pass.cpp
+++ b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_rv.pass.cpp
@@ -42,6 +42,7 @@ int A::count = 0;
int main()
{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::shared_ptr pA(new A);
A* ptrA = pA.get();
@@ -118,4 +119,5 @@ int main()
}
assert(B::count == 0);
assert(A::count == 0);
+#endif // _LIBCXX_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp
index a4729434..27046cf5 100644
--- a/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp
+++ b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp
@@ -85,9 +85,17 @@ int main()
}
catch (...)
{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
assert(A::count == 1);
assert(B::count == 1);
assert(ptr.get() == raw_ptr);
+#else
+ // Without rvalue references, ptr got copied into
+ // the shared_ptr destructor and the copy was
+ // destroyed during unwinding.
+ assert(A::count == 0);
+ assert(B::count == 0);
+#endif
}
}
assert(A::count == 0);
diff --git a/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
index 46ac22d4..b8418338 100644
--- a/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
+++ b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
@@ -77,9 +77,15 @@ int main()
}
catch (...)
{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
assert(A::count == 1);
assert(B::count == 1);
assert(ptr.get() == raw_ptr);
+#else
+ assert(A::count == 0);
+ assert(B::count == 0);
+ assert(ptr.get() == 0);
+#endif
}
}
assert(A::count == 0);