Skip to content

constrained template friend incorrectly flagged as invalid #11573

@00001H

Description

@00001H

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Language ServiceVisual StudioInherited from Visual Studiobugmore votes neededIssues that have been postponed until more community members upvote it

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions