2 // { dg-do compile { target c++11 } }
4 using size_t = decltype(sizeof(0));
6 template<typename T> struct tuple_size;
8 template<typename T, size_t U = tuple_size<T>::value>
9 using __has_tuple_size = T;
11 template<typename T> struct tuple_size<const __has_tuple_size<T>> {
12 static constexpr size_t value = tuple_size<T>::value;
15 template<typename T> struct tuple_size<volatile __has_tuple_size<T>> {
16 static constexpr size_t value = tuple_size<T>::value;
19 template<typename T> struct tuple_size<const __has_tuple_size<volatile T>> {
20 static constexpr size_t value = tuple_size<T>::value;
23 template<typename... T> struct tuple { };
24 template<typename... T> struct tuple_size<tuple<T...>> {
25 static constexpr size_t value = sizeof...(T);
28 static_assert( tuple_size<const tuple<>>::value == 0, "" ); // OK
29 static_assert( tuple_size<volatile tuple<>>::value == 0, "" ); // OK
30 static_assert( tuple_size<const volatile tuple<>>::value == 0, "" ); // FAIL