最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c++ - Clangd is parsing object instantiation as function declaration (not MVP ambiguity) - Stack Overflow

programmeradmin0浏览0评论

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?

发布评论

评论列表(0)

  1. 暂无评论