https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86252
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Another testcase, reduced from Boost.Rational:
template<typename T>
struct sfinae
{
static const bool value = false;
static T zero() { return T(); }
};
template<bool, typename T = void>
struct enable_if { typedef T type; };
template<typename T> struct enable_if<false, T> { };
struct Abstract {
virtual void f() = 0;
};
struct X {
template<typename T>
X(const T&, typename enable_if<sfinae<T>::value>::type* = 0)
{ }
};
Abstract* a();
int f(const Abstract&);
void f(X);
int i = f(*a());