Home | History | Annotate | Download | only in tuple.elem
      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 // <tuple>
     11 
     12 // template <class... Types> class tuple;
     13 
     14 // template <size_t I, class... Types>
     15 //   const typename tuple_element<I, tuple<Types...> >::type&&
     16 //   get(const tuple<Types...>&& t);
     17 
     18 // UNSUPPORTED: c++98, c++03
     19 
     20 #include <tuple>
     21 
     22 template <class T> void cref(T const&) {}
     23 template <class T> void cref(T const&&) = delete;
     24 
     25 std::tuple<int> const tup4() { return std::make_tuple(4); }
     26 
     27 int main()
     28 {
     29     // LWG2485: tuple should not open a hole in the type system, get() should
     30     // imitate [expr.ref]'s rules for accessing data members
     31     {
     32         cref(std::get<0>(tup4()));  // expected-error {{call to deleted function 'cref'}}
     33     }
     34 }
     35