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

constrained template friend incorrectly flagged as invalid

Open 00001H 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

00001H avatar Oct 24 '23 05:10 00001H