xref: /llvm-project/libcxx/test/std/utilities/utility/pairs/pair.astuple/get_const.verify.cpp (revision 4537bda929bd874658f9d66ad2c55d81268c8b98)
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <utility>
10 
11 // template <class T1, class T2> struct pair
12 
13 // template<size_t I, class T1, class T2>
14 //     const typename tuple_element<I, std::pair<T1, T2> >::type&
15 //     get(const pair<T1, T2>&);
16 
17 #include <utility>
18 
f()19 void f() {
20   typedef std::pair<int, short> P;
21   const P p(3, 4);
22   std::get<0>(p) = 5; // expected-error {{cannot assign to return value}}
23 }
24