blob: 6d61c47ffbf031f092311546da4273d03d467059 [file] [log] [blame]
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <utility>
// template <class T1, class T2> struct pair
// template<size_t I, class T1, class T2>
// typename tuple_element<I, std::pair<T1, T2> >::type&
// get(pair<T1, T2>&);
#include <utility>
#include <cassert>
#if __cplusplus > 201103L
struct S {
std::pair<int, int> a;
int k;
constexpr S() : a{1,2}, k(std::get<0>(a)) {}
};
constexpr std::pair<int, int> getP () { return { 3, 4 }; }
#endif
int main()
{
{
typedef std::pair<int, short> P;
P p(3, 4);
assert(std::get<0>(p) == 3);
assert(std::get<1>(p) == 4);
std::get<0>(p) = 5;
std::get<1>(p) = 6;
assert(std::get<0>(p) == 5);
assert(std::get<1>(p) == 6);
}
#if __cplusplus > 201103L
{
static_assert(S().k == 1, "");
static_assert(std::get<1>(getP()) == 4, "");
}
#endif
}