Implement LWG2350: min, max, and minmax should be constexpr.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@201697 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -45,4 +45,18 @@ int main()
|
||||
test(x, y, y, x);
|
||||
test(y, x, y, x);
|
||||
}
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
{
|
||||
// Note that you can't take a reference to a local var, since
|
||||
// it's address is not a compile-time constant.
|
||||
constexpr static int x = 1;
|
||||
constexpr static int y = 0;
|
||||
constexpr auto p1 = std::minmax (x, y);
|
||||
static_assert(p1.first == y, "");
|
||||
static_assert(p1.second == x, "");
|
||||
constexpr auto p2 = std::minmax (y, x);
|
||||
static_assert(p2.first == y, "");
|
||||
static_assert(p2.second == x, "");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user