| 1 |
// PR c++/62255 |
| 2 |
|
| 3 |
// It's not clear whether this is well-formed; instantiating the |
| 4 |
// initializer of 'value' causes the instantiation of Derived, which in |
| 5 |
// turn requires the value of 'value', but the recursion ends there, so it |
| 6 |
// seems reasonable to allow it. |
| 7 |
|
| 8 |
template <typename T> struct Test { |
| 9 |
template<typename X> static int check(typename X::Type*); |
| 10 |
template<typename> static char check(...); |
| 11 |
static const bool value = (sizeof(check<T>(0)) == sizeof(int)); |
| 12 |
}; |
| 13 |
template <int> struct Sink { }; |
| 14 |
template <typename T> struct Derived : Sink<Test<Derived<T> >::value> { |
| 15 |
typedef int Type; |
| 16 |
}; |
| 17 |
|
| 18 |
Sink<Test<Derived<int> >::value> s; |