This code
#include<functional>
int foo(char);
int main()
{
std::function<decltype((foo))> f;
}
gives the error:
aggregate ‘std::function<int (&)(char)> f’ has incomplete type
and cannot be defined
in gcc-4.7.2. I thought it would compile.
I know that I could drop the additional parenthesis to make it work, but I am trying to understand what is happening.
I do not understand why decltype adds a reference. I would think that a function name in parenthesis is a prvalue and thus that decltype deduces the type without adding a reference.