//===----------------------------------------------------------------------===// // // 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 #include "test_macros.h" #if TEST_STD_VER > 11 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, static_cast(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 TEST_STD_VER > 11 { static_assert(S().k == 1, ""); static_assert(std::get<1>(getP()) == 4, ""); } #endif }