In my clangd, I also get the same error with that code, I solved it by using:
#include <iostream> #include <functional> using namespace std; int main() { function<bool()> fn; }