get_const.fail.cpp revision b64f8b07c104c6cc986570ac8ee0ed16a9f23976
1//===----------------------------------------------------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is dual licensed under the MIT and the University of Illinois Open 6// Source Licenses. 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