//===----------------------------------------------------------------------===// // // 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. // //===----------------------------------------------------------------------===// // // template struct pair // template // typename tuple_element >::type& // get(pair&); #include #include #if __cplusplus > 201103L struct S { std::pair a; int k; constexpr S() : a{1,2}, k(std::get<0>(a)) {} }; constexpr std::pair getP () { return { 3, 4 }; } #endif int main() { { typedef std::pair 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 }