[Bug c++/86252] Abstract class in function return type

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Feb 11 22:29:00 GMT 2019


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());


More information about the Gcc-bugs mailing list