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