using _Tp1 = typename _Tp::first_type;
using _Tp2 = typename _Tp::second_type;
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 3527. uses_allocator_construction_args handles rvalue pairs
+ // of rvalue references incorrectly
return std::make_tuple(piecewise_construct,
std::uses_allocator_construction_args<_Tp1>(__a,
- std::move(__pr).first),
+ std::get<0>(std::move(__pr))),
std::uses_allocator_construction_args<_Tp2>(__a,
- std::move(__pr).second));
+ std::get<1>(std::move(__pr))));
}
#if __cplusplus > 202002L
return std::make_tuple(piecewise_construct,
std::uses_allocator_construction_args<_Tp1>(__a,
- std::move(__pr).first),
+ std::get<0>(std::move(__pr))),
std::uses_allocator_construction_args<_Tp2>(__a,
- std::move(__pr).second));
+ std::get<1>(std::move(__pr))));
}
#endif // C++23
--- /dev/null
+// { dg-do compile { target c++11 } }
+
+#include <utility>
+
+template<int N, typename T, typename Pair>
+constexpr bool
+check()
+{
+ return std::is_same<decltype(std::get<N>(std::declval<Pair>())), T>::value;
+}
+
+void
+test_value_category()
+{
+ using P = std::pair<int, long>;
+ static_assert( check<0, int&, P&>(),
+ "get<0>(pair<T1, T2>&)" );
+ static_assert( check<1, long&, P&>(),
+ "get<1>(pair<T1, T2>&)" );
+ static_assert( check<0, int&&, P&&>(),
+ "get<0>(pair<T1, T2>&&)" );
+ static_assert( check<1, long&&, P&&>(),
+ "get<1>(pair<T1, T2>&&)" );
+ static_assert( check<0, const int&, const P&>(),
+ "get<0>(const pair<T1, T2>&)" );
+ static_assert( check<1, const long&, const P&>(),
+ "get<1>(const pair<T1, T2>&)" );
+ static_assert( check<0, const int&&, const P&&>(),
+ "get<0>(const pair<T1, T2>&&)" );
+ static_assert( check<1, const long&&, const P&&>(),
+ "get<1>(const pair<T1, T2>&&)" );
+
+ using PL = std::pair<int&, long&>;
+ static_assert( check<0, int&, PL&>(),
+ "get<0>(pair<T1&, T2&>&)" );
+ static_assert( check<1, long&, PL&>(),
+ "get<1>(pair<T1&, T2&>&)" );
+ static_assert( check<0, int&, PL&&>(),
+ "get<0>(pair<T1&, T2&>&&)" );
+ static_assert( check<1, long&, PL&&>(),
+ "get<1>(pair<T1&, T2&>&&)" );
+ static_assert( check<0, int&, const PL&>(),
+ "get<0>(const pair<T1&, T2&>&)" );
+ static_assert( check<1, long&, const PL&>(),
+ "get<1>(const pair<T1&, T2&>&)" );
+ static_assert( check<0, int&, const PL&&>(),
+ "get<0>(const pair<T1&, T2&>&&)" );
+ static_assert( check<1, long&, const PL&&>(),
+ "get<1>(const pair<T1&, T2&>&&)" );
+
+ using PR = std::pair<int&&, long&&>;
+ static_assert( check<0, int&, P&>(),
+ "get<0>(pair<T1&&, T2&&>&)" );
+ static_assert( check<1, long&, P&>(),
+ "get<1>(pair<T1&&, T2&&>&)" );
+ static_assert( check<0, int&&, PR&&>(),
+ "get<0>(pair<T1&&, T2&&>&&)" );
+ static_assert( check<1, long&&, PR&&>(),
+ "get<1>(pair<T1&&, T2&&>&&)" );
+ static_assert( check<0, int&, const PR&>(),
+ "get<0>(const pair<T1&&, T2&&>&)" );
+ static_assert( check<1, long&, const PR&>(),
+ "get<1>(const pair<T1&&, T2&&>&)" );
+ static_assert( check<0, int&&, const PR&&>(),
+ "get<0>(const pair<T1&&, T2&&>&&)" );
+ static_assert( check<1, long&&, const PR&&>(),
+ "get<1>(const pair<T1&&, T2&&>&&)" );
+}