vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

constrained template friend incorrectly flagged as invalid

Open marralesfios opened this issue 2 years ago • 3 comments

Environment

  • OS and Version: Windows 10 22h2
  • VS Code Version: 1.84.0
  • C/C++ Extension Version: v1.18.0

Bug Summary and Steps to Reproduce

Bug Summary: image

Steps to reproduce:

  1. Paste this code into a new project
#include<concepts>
#include<vector>
#include<memory>
class BaseNode{
    int value;
    template<std::derived_from<BaseNode> T>
    friend class Database;
    public:
        virtual ~BaseNode(){}
};
template<std::derived_from<BaseNode> T>
class Database{
    std::vector<std::unique_ptr<BaseNode>> nodes;
};
int main(){}
  1. See error

Expected behavior: No error, as compiling with g++ gives no errors.

Configuration and Logs

{
  "configurations": [
    {
      "name": "windows-gcc-x64",
      "includePath": [
        "E:\\",
        "E:\\include"
      ],
      "compilerPath": "D:\\msys64\\mingw64\\bin\\g++.exe",
      "cStandard": "c23",
      "cppStandard": "c++23",
      "intelliSenseMode": "windows-gcc-x64",
      "compilerArgs": [
        "-fno-ms-extensions"
      ]
    }
  ],
  "version": 4
}

Other Extensions

No response

Additional context

No response

marralesfios avatar Oct 24 '23 05:10 marralesfios

@00001H What version of g++ are you using?

sean-mcmanus avatar Oct 25 '23 21:10 sean-mcmanus

@00001H I figured it out -- it repros with 12.x and not 11.x.

sean-mcmanus avatar Oct 25 '23 21:10 sean-mcmanus

@00001H I've filed a bug on our shared VS parser at https://developercommunity.visualstudio.com/t/C-IntelliSense-incorrect-gives-error-/10500352 .

sean-mcmanus avatar Oct 25 '23 22:10 sean-mcmanus