aaronfu
aaronfu

Reputation: 113

Clangd is parsing object instantiation as function declaration (not MVP ambiguity)

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:

enter image description here

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?

Upvotes: 1

Views: 27

Answers (0)

Related Questions