类似以下内容:
#include <functional> int main() { std::function<int(int)> func = [](int x){return x;}; int* Fptr(int) = &func; //error }
我得到的错误是
temp.cpp: In function ‘int main()’: temp.cpp:6:15: warning: declaration of ‘int* Fptr(int)’ has ‘extern’ and is initialized int* Fptr(int) = &func; //error ^ temp.cpp:6:20: error: invalid pure specifier (only ‘= 0’ is allowed) before ‘func’ int* Fptr(int) = &func; //error ^ temp.cpp:6:20: error: function ‘int* Fptr(int)’ is initialized like a variable