| 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 <class... Types> |
| 14 | // class tuple_size<tuple<Types...>> |
| 15 | // : public integral_constant<size_t, sizeof...(Types)> { }; |
| 16 | |
| 17 | // UNSUPPORTED: c++03 |
| 18 | |
| 19 | #include <tuple> |
| 20 | #include <utility> |
| 21 | |
| 22 | #include "test_macros.h" |
| 23 | |
| 24 | template <class T, class = decltype(std::tuple_size<T>::value)> |
| 25 | constexpr bool has_value(int) { return true; } |
| 26 | template <class> constexpr bool has_value(long) { return false; } |
| 27 | template <class T> constexpr bool has_value() { return has_value<T>(0); } |
| 28 | |
| 29 | struct Dummy {}; |
| 30 | |
| 31 | int main(int, char**) { |
| 32 | // Test that the ::value member does not exist |
| 33 | static_assert(has_value<std::tuple<int> const>(), "" ); |
| 34 | static_assert(has_value<std::pair<int, long> volatile>(), "" ); |
| 35 | static_assert(!has_value<int>(), "" ); |
| 36 | static_assert(!has_value<const int>(), "" ); |
| 37 | static_assert(!has_value<volatile void>(), "" ); |
| 38 | static_assert(!has_value<const volatile std::tuple<int>&>(), "" ); |
| 39 | |
| 40 | return 0; |
| 41 | } |
| 42 | |