Implement LWG 2773 - std::ignore should be constexpr.
In addition to the PR for LWG 2773 this patch also ensures that each of std::ignores constructors or assignment operators are constexpr. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294165 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -22,6 +22,24 @@
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
#if TEST_STD_VER > 11
|
||||
constexpr bool test_tie_constexpr() {
|
||||
{
|
||||
int i = 42;
|
||||
double f = 1.1;
|
||||
using ExpectT = std::tuple<int&, decltype(std::ignore)&, double&>;
|
||||
auto res = std::tie(i, std::ignore, f);
|
||||
static_assert(std::is_same<ExpectT, decltype(res)>::value, "");
|
||||
assert(&std::get<0>(res) == &i);
|
||||
assert(&std::get<1>(res) == &std::ignore);
|
||||
assert(&std::get<2>(res) == &f);
|
||||
// FIXME: If/when tuple gets constexpr assignment
|
||||
//res = std::make_tuple(101, nullptr, -1.0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
@@ -39,5 +57,8 @@ int main()
|
||||
static_assert ( std::get<0>(t) == 42, "" );
|
||||
static_assert ( std::get<1>(t) == 1.1, "" );
|
||||
}
|
||||
{
|
||||
static_assert(test_tie_constexpr(), "");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user