This is a pretty far-fetched example of a function trying to return a function:
void foo() { } template<typename T> T f() { return foo; } int main(){ f<decltype(foo)>(); }
This is the error I get from Clang 3.2:
Compilation finished with errors: source.cpp:7:5: error: no matching function for call to 'f' f<decltype(foo)>(); ^~~~~~~~~~~~~~~~ source.cpp:4:3: note: candidate template ignored: substitution failure [with T = void ()]: function cannot return function type 'void ()' T f() { return foo; } ~ ^ 1 error generated.
source share