#include <type_traits>

struct Y{};

struct X{
  bool operator()(Y const&);
  long operator()(Y&&);
};

Y const f();

int main(){
  static_assert(std::is_same<std::result_of<X(Y const)>::type, bool>(), "/cry");
  
  X x;
  using result_type = decltype(x(f()));
  static_assert(std::is_same<result_type, bool>(), "/yay");
}