I'm trying to get the return type of an auto
function. This works:
auto foo(int bar)
{
return 0;
}
typedef std::result_of<decltype(foo)> foo_t;
Great, here's the next step then: getting the return type of a static auto
function in a class scope. This also works:
struct Foo
{
static auto foo(int bar)
{
return 0;
}
};
typedef std::result_of<decltype(Foo::foo)> foo_t;
But this doesn't work:
struct Foo
{
static auto foo(int bar)
{
return 0;
}
typedef std::result_of<decltype(Foo::foo)> foo_t;
};
GCC says "error: use of 'static auto Foo::foo(int)' before deduction of 'auto'", Clang says "function 'foo' with deduced return type cannot be used before it is defined". Why?
std::result_of<decltype(&foo)(int)>::type
isn't it? – Honebein