Vscode-cpptools: Linting: in-class friend function not identified.

Created on 13 Nov 2019  路  3Comments  路  Source: microsoft/vscode-cpptools

Type: LanguageService

Describe the bug

  • OS and Version: Linux x64 5.3.10-arch1-1
  • VS Code Version: 1.40.0
  • C/C++ Extension Version: 0.26.2-insiders

In-class friend function definition not identified by linter/parser.

To Reproduce


Open test.cpp which contains the following code:

#include <iostream>

struct A {
  friend void fri(A) { std::cout << "fri()" << std::endl; }
  void mem() {
    std::cout << "mem(A)" << std::endl;
    fri(*this);
  }
};

int main() {
  A a;
  fri(a);
  a.mem();
}

Expected behavior

Don't report problems as g++ doesn't complain during compilation.

$ g++ -std=c++17 vscode_debug.cpp -o a.out && ./a.out
fri()
mem(A)
fri()

Screenshots

image

image

Language Service Visual Studio bug external

Most helpful comment

Hi @escape0707 . Thanks for reporting this. The C/C++ Extension shares common code with Visual Studio for IntelliSense. I was able to reproduce something similar in Visual Studio, and have opened the following:
https://developercommunity.visualstudio.com/content/problem/819122/incorrect-squiggle-on-use-of-in-class-friend-funct.html

All 3 comments

Hi @escape0707 . Thanks for reporting this. The C/C++ Extension shares common code with Visual Studio for IntelliSense. I was able to reproduce something similar in Visual Studio, and have opened the following:
https://developercommunity.visualstudio.com/content/problem/819122/incorrect-squiggle-on-use-of-in-class-friend-funct.html

@escape0707 I recommend (using your|creating a) Microsoft Account to upvote the developer community issue. Issues with zero upvotes tend to stay unresolved for _quite_ some time.

@escape0707 I recommend (using your|creating a) Microsoft Account to upvote the developer community issue. Issues with zero upvotes tend to stay unresolved for _quite_ some time.

Okay, upvoted. Thanks for reminding me!

Was this page helpful?
0 / 5 - 0 ratings