Comeau doesn't like auto as a top level return type, but the following compiles successfully:
template <typename R, typename C, typename A1> R get_return_type(R (C::*)(A1));
struct A
{
int f(int);
decltype(get_return_type(&A::f)) g(int x);
};
Basically, you have to declare at least one additional construct that gets you the type you want. And use decltype directly.
EDIT: Incidentally, this works fine for diving into the return type of a member function as well:
template <typename R, typename C, typename A1> R get_return_type(R (C::*)(A1));
struct B { int f(int); };
struct A
{
int f(int);
B h(int);
decltype(get_return_type(&A::f)) g(int x);
decltype(get_return_type(&A::h).f(0)) k(int x);
};
int main()
{
return A().k(0);
}
Granted, it doesn't have the same convenience of auto f()-> ..., but at least it compiles.