summaryrefslogtreecommitdiff
path: root/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-07-23 20:47:26 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-07-23 20:47:26 +0000
commit51072bd6bf79ef2bc6a922079bff57c31c1effbc (patch)
tree91a2effbc9e6f80bdbbf9eb70e06c51ad0867ea0 /test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp
parentbb5e33f003797b67974a8893f7f2930fc51b8210 (diff)
Notes
Diffstat (limited to 'test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp')
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp
index 11bfdd0c94a98..afd3e0fdb8e3d 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp
@@ -37,6 +37,13 @@ struct D
explicit D(int i) : B(i) {}
};
+struct E {
+ E() = default;
+ E& operator=(int val) {
+ return *this;
+ }
+};
+
int main()
{
{
@@ -88,4 +95,16 @@ int main()
assert(std::get<1>(t1) == int('a'));
assert(std::get<2>(t1)->id_ == 3);
}
+ {
+ // Test that tuple evaluates correctly applies an lvalue reference
+ // before evaluating is_assignable (ie 'is_assignable<int&, int&&>')
+ // instead of evaluating 'is_assignable<int&&, int&&>' which is false.
+ int x = 42;
+ int y = 43;
+ std::tuple<int&&, E> t(std::move(x), E{});
+ std::tuple<int&&, int> t2(std::move(y), 44);
+ t = std::move(t2);
+ assert(std::get<0>(t) == 43);
+ assert(&std::get<0>(t) == &x);
+ }
}