mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-24 20:29:39 +08:00
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>>); git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@359255 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user