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 <class... Types> 15 // class tuple_size<tuple<Types...>> 16 // : public integral_constant<size_t, sizeof...(Types)> { }; 17 18 // XFAIL: gcc-4.9 19 // UNSUPPORTED: c++98, c++03 20 21 #include <tuple> 22 #include <type_traits> 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() { 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