Make tuple's constructor and std::get<>(tuple) constexpr. Final stage of fixing bug #16599. Thanks to Howard for the review and updates.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@186834 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow
2013-07-22 16:02:19 +00:00
parent 8fc4f5a251
commit da0a0e8a1b
13 changed files with 263 additions and 56 deletions

View File

@@ -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));