Bug 16599 part 2: Make std::pair's constructors and comparison operators (and make_pair) constexpr.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@186430 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow
2013-07-16 17:45:44 +00:00
parent 01a0e90783
commit 206f6cdc33
8 changed files with 135 additions and 30 deletions

View File

@@ -23,6 +23,7 @@ int main()
assert(p1.first == 3);
assert(p1.second == 4);
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::pair<std::unique_ptr<int>, short> P1;
@@ -37,4 +38,14 @@ int main()
assert(p1.second == 4);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if _LIBCPP_STD_VER > 11
{
typedef std::pair<int, short> P1;
constexpr P1 p1 = std::make_pair(3, 4);
static_assert(p1.first == 3, "");
static_assert(p1.second == 4, "");
}
#endif
}