diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/template/recurse4.C')
-rw-r--r-- | gcc/testsuite/g++.dg/template/recurse4.C | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/template/recurse4.C b/gcc/testsuite/g++.dg/template/recurse4.C new file mode 100644 index 00000000000..ee8d1b70df9 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/recurse4.C @@ -0,0 +1,18 @@ +// PR c++/62255 + +// It's not clear whether this is well-formed; instantiating the +// initializer of 'value' causes the instantiation of Derived, which in +// turn requires the value of 'value', but the recursion ends there, so it +// seems reasonable to allow it. + +template <typename T> struct Test { + template<typename X> static int check(typename X::Type*); + template<typename> static char check(...); + static const bool value = (sizeof(check<T>(0)) == sizeof(int)); +}; +template <int> struct Sink { }; +template <typename T> struct Derived : Sink<Test<Derived<T> >::value> { + typedef int Type; +}; + +Sink<Test<Derived<int> >::value> s; |