view gcc/testsuite/g++.dg/template/recurse4.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// 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;