summaryrefslogtreecommitdiffstats
path: root/libcxx/test
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2019-04-26 01:02:18 +0000
committerEric Fiselier <eric@efcs.ca>2019-04-26 01:02:18 +0000
commit7e528bc4ce51daae5b90bf641f15ea564901de8b (patch)
treedcbce5acb5b1133b8608ebc91ceedc0ec9530eb6 /libcxx/test
parent1b76063a5e023b39b4a395d7fc68fd5fe1e6aba3 (diff)
downloadbcm5719-llvm-7e528bc4ce51daae5b90bf641f15ea564901de8b.tar.gz
bcm5719-llvm-7e528bc4ce51daae5b90bf641f15ea564901de8b.zip
Fix return type of std::tuple_cat.
When the arguments to tuple cat were const, the const was incorrectly propagated into the type of the resulting tuple. For example: const std::tuple<int> t(42); auto r = std::tuple_cat(t, t); // Incorrect! should be std::tuple<int, int>. static_assert(is_same_v<decltype(r), std::tuple<const int, const int>>); llvm-svn: 359255
Diffstat (limited to 'libcxx/test')
-rw-r--r--libcxx/test/std/utilities/tuple/tuple.tuple/tuple.creation/tuple_cat.pass.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.creation/tuple_cat.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.creation/tuple_cat.pass.cpp
index 40efbd1b801..5d5927d253a 100644
--- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.creation/tuple_cat.pass.cpp
+++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.creation/tuple_cat.pass.cpp
@@ -238,6 +238,21 @@ int main(int, char**)
);
assert(t2 == std::make_tuple(std::make_tuple(1), std::make_tuple(2)));
}
+ {
+ int x = 101;
+ std::tuple<int, int&, const int&, int&&> t(42, x, x, std::move(x));
+ const auto& ct = t;
+ std::tuple<int, int&, const int&> t2(42, x, x);
+ const auto& ct2 = t2;
+
+ auto r = std::tuple_cat(std::move(t), std::move(ct), t2, ct2);
+ ASSERT_SAME_TYPE(decltype(r), std::tuple<
+ int, int&, const int&, int&&,
+ int, int&, const int&, int&&,
+ int, int&, const int&,
+ int, int&, const int&>);
+ ((void)r);
+ }
return 0;
}
OpenPOWER on IntegriCloud