GCC 4.8.1 likes this:
template <typename T = decltype(std::declval<Base const>().f())>
You need to tell the compiler that the object through which you make the call is const
.
You cannot specify Derived
here in this declval
because at the point of the call, Derived
is an incomplete type. In addition, you don't even need Derived
as part of the declval
since f()
is a member of Base
.