admin管理员组

文章数量:1335083

I have the following c++ code

struct Foo {
  Foo(int x) {}
};

int main() {
  int x = 42;
  Foo f(x);
}

That I can compile and execute with clang++. However, if I open this code in Neovim, my LSP (clangd) recognizes f as a function rather than an object:

At first I thought this might have something to do with the most-vexing-parse, however I don't think the code has any ambiguity as it is clear that x is an integer object. Any suggestion on how I can fix the clangd parsing?

本文标签: cClangd is parsing object instantiation as function declaration (not MVP ambiguity)Stack Overflow