summaryrefslogtreecommitdiffstats
path: root/libcxx/test/utilities/tuple/tuple.tuple/tuple.creation
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2013-07-22 16:02:19 +0000
committerMarshall Clow <mclow.lists@gmail.com>2013-07-22 16:02:19 +0000
commit75eff74803140f4e0d8713b7d55f8da70472b10b (patch)
treefd012f65e854909f272a29cdf60f706b3d4a3510 /libcxx/test/utilities/tuple/tuple.tuple/tuple.creation
parent087f926a241bd70b16e47cd061a555d6add8d1ce (diff)
downloadbcm5719-llvm-75eff74803140f4e0d8713b7d55f8da70472b10b.tar.gz
bcm5719-llvm-75eff74803140f4e0d8713b7d55f8da70472b10b.zip
Make tuple's constructor and std::get<>(tuple) constexpr. Final stage of fixing bug #16599. Thanks to Howard for the review and updates.
llvm-svn: 186834
Diffstat (limited to 'libcxx/test/utilities/tuple/tuple.tuple/tuple.creation')
-rw-r--r--libcxx/test/utilities/tuple/tuple.tuple/tuple.creation/make_tuple.pass.cpp9
-rw-r--r--libcxx/test/utilities/tuple/tuple.tuple/tuple.creation/tuple_cat.pass.cpp28
2 files changed, 36 insertions, 1 deletions
diff --git a/libcxx/test/utilities/tuple/tuple.tuple/tuple.creation/make_tuple.pass.cpp b/libcxx/test/utilities/tuple/tuple.tuple/tuple.creation/make_tuple.pass.cpp
index f3dba384695..4b6649a0507 100644
--- a/libcxx/test/utilities/tuple/tuple.tuple/tuple.creation/make_tuple.pass.cpp
+++ b/libcxx/test/utilities/tuple/tuple.tuple/tuple.creation/make_tuple.pass.cpp
@@ -38,4 +38,13 @@ int main()
assert(i == 0);
assert(j == 0);
}
+#if _LIBCPP_STD_VER > 11
+ {
+ constexpr auto t1 = std::make_tuple(0, 1, 3.14);
+ constexpr int i1 = std::get<1>(t1);
+ constexpr double d1 = std::get<2>(t1);
+ static_assert (i1 == 1, "" );
+ static_assert (d1 == 3.14, "" );
+ }
+#endif
}
diff --git a/libcxx/test/utilities/tuple/tuple.tuple/tuple.creation/tuple_cat.pass.cpp b/libcxx/test/utilities/tuple/tuple.tuple/tuple.creation/tuple_cat.pass.cpp
index 7cfc736fb79..b47842d419c 100644
--- a/libcxx/test/utilities/tuple/tuple.tuple/tuple.creation/tuple_cat.pass.cpp
+++ b/libcxx/test/utilities/tuple/tuple.tuple/tuple.creation/tuple_cat.pass.cpp
@@ -36,12 +36,38 @@ int main()
{
std::tuple<> t = std::tuple_cat(std::array<int, 0>());
}
-
{
std::tuple<int> t1(1);
std::tuple<int> t = std::tuple_cat(t1);
assert(std::get<0>(t) == 1);
}
+
+#if _LIBCPP_STD_VER > 11
+ {
+ constexpr std::tuple<> t = std::tuple_cat();
+ }
+ {
+ constexpr std::tuple<> t1;
+ constexpr std::tuple<> t2 = std::tuple_cat(t1);
+ }
+ {
+ constexpr std::tuple<> t = std::tuple_cat(std::tuple<>());
+ }
+ {
+ constexpr std::tuple<> t = std::tuple_cat(std::array<int, 0>());
+ }
+ {
+ constexpr std::tuple<int> t1(1);
+ constexpr std::tuple<int> t = std::tuple_cat(t1);
+ static_assert(std::get<0>(t) == 1, "");
+ }
+ {
+ constexpr std::tuple<int> t1(1);
+ constexpr std::tuple<int, int> t = std::tuple_cat(t1, t1);
+ static_assert(std::get<0>(t) == 1, "");
+ static_assert(std::get<1>(t) == 1, "");
+ }
+#endif
{
std::tuple<int, MoveOnly> t =
std::tuple_cat(std::tuple<int, MoveOnly>(1, 2));
OpenPOWER on IntegriCloud