summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/std')
-rw-r--r--libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable.pass.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable.pass.cpp
index 9d01128379a..b17ca76fd58 100644
--- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable.pass.cpp
@@ -49,8 +49,21 @@ struct M {
void swap(M&&, M&&) {}
+struct DeletedSwap {
+ friend void swap(DeletedSwap&, DeletedSwap&) = delete;
+};
+
} // namespace MyNS
+namespace MyNS2 {
+
+struct AmbiguousSwap {};
+
+template <class T>
+void swap(T&, T&) {}
+
+} // end namespace MyNS2
+
int main()
{
using namespace MyNS;
@@ -70,6 +83,14 @@ int main()
static_assert(!std::is_swappable<int() &>::value, "");
}
{
+ // test that a deleted swap is correctly handled.
+ static_assert(!std::is_swappable<DeletedSwap>::value, "");
+ }
+ {
+ // test that a swap with ambiguous overloads is handled correctly.
+ static_assert(!std::is_swappable<MyNS2::AmbiguousSwap>::value, "");
+ }
+ {
// test for presence of is_swappable_v
static_assert(std::is_swappable_v<int>, "");
static_assert(!std::is_swappable_v<M>, "");
OpenPOWER on IntegriCloud