1 // PR c++/79960
2 // { dg-do compile { target c++11 } }
3 
4 using size_t = decltype(sizeof(0));
5 
6 template<typename T> struct tuple_size;
7 
8 template<typename T, size_t U = tuple_size<T>::value>
9   using __has_tuple_size = T;
10 
11 template<typename T> struct tuple_size<const __has_tuple_size<T>> {
12   static constexpr size_t value = tuple_size<T>::value;
13 };
14 
15 template<typename T> struct tuple_size<volatile __has_tuple_size<T>> {
16   static constexpr size_t value = tuple_size<T>::value;
17 };
18 
19 template<typename T> struct tuple_size<const __has_tuple_size<volatile T>> {
20   static constexpr size_t value = tuple_size<T>::value;
21 };
22 
23 template<typename... T> struct tuple { };
24 template<typename... T> struct tuple_size<tuple<T...>> {
25   static constexpr size_t value = sizeof...(T);
26 };
27 
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
31