get_const.fail.cpp revision f5256e16dfc425c1d466f6308d4026d529ce9e0b
1//===----------------------------------------------------------------------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// <utility>
11
12// template <class T1, class T2> struct pair
13
14// template<size_t I, class T1, class T2>
15//     const typename tuple_element<I, std::pair<T1, T2> >::type&
16//     get(const pair<T1, T2>&);
17
18#include <utility>
19#include <cassert>
20
21int main()
22{
23    {
24        typedef std::pair<int, short> P;
25        const P p(3, 4);
26        assert(std::get<0>(p) == 3);
27        assert(std::get<1>(p) == 4);
28        std::get<0>(p) = 5;
29    }
30}
31