microsoft / microsoft/vscode-cpptools

Concepts with Lambdas gives an incorrect error message

Open
#11,624 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Language Service Visual Studio
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and Version: Windows 10, 21H1 (Build: 19043.1826)
  • VS Code Version: 1.84.0
  • C/C++ Extension Version: 1.17.5
Bug Summary and Steps to Reproduce

When using concepts that call static methods with lambdas the language server crashes.
This does not happen when no lambdas are used.

Reproduction Code
#include <concepts>

struct fullfills_my_concept
{
    template <typename Function>
    static auto test(const Function& func)
    {
        return 10;
    }
};

template <typename T>
concept MyConcept = requires {
    {
        T::test([]() { return 20; })
    } -> std::same_as<int>;
};

template <MyConcept T = fullfills_my_concept>
struct reprod
{
    reprod() { }
};

int main()
{
    reprod test{};

    return 0;
}

Screenshot 2023-11-04 040959

Configuration and Logs
{
    "configurations": [
        {
            "name": "Win32",
            "cStandard": "c23",
            "cppStandard": "c++20",
            "intelliSenseMode": "windows-msvc-x64",
            "configurationProvider": "ms-vscode.cmake-tools"
        }
    ],
    "version": 4
}

-------- Diagnostics - 11/4/2023, 4:11:35 AM
Version: 1.17.5
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "c:/Users/<redacted>/Desktop/issue/**"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "windowsSdkVersion": "10.0.19041.0",
    "compilerPath": "cl.exe",
    "cStandard": "c17",
    "cppStandard": "c++17",
    "intelliSenseMode": "windows-msvc-x64",
    "compilerPathInCppPropertiesJson": "cl.exe",
    "intelliSenseModeIsExplicit": false,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": false,
    "mergeConfigurations": false,
    "compilerPathIsExplicit": false,
    "configurationProvider": "ms-vscode.cmake-tools",
    "browse": {
        "path": [
            "c:/Users/<redacted>/Desktop/issue/**",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Custom browse configuration: 
{
    "browsePath": [
        "c:/users/<redacted>/desktop/issue/build/cmakefiles/6855ef14fe638dc4888b0263f0c102ac",
        "c:/users/<redacted>/desktop/issue"
    ],
    "compilerPath": "c:/program files/microsoft visual studio/2022/community/vc/tools/msvc/14.37.32822/bin/hostx64/x64/cl.exe",
    "compilerArgs": [],
    "compilerFragments": [
        "/DWIN32 /D_WINDOWS /EHsc /Zi /Ob0 /Od /RTC1 -std:c++20 -MDd"
    ]
}
Custom configurations:
[ C:\Users\<redacted>\Desktop\issue\main.cpp ]
{
    "includePath": [],
    "defines": [],
    "compilerPath": "c:/program files/microsoft visual studio/2022/community/vc/tools/msvc/14.37.32822/bin/hostx64/x64/cl.exe",
    "compilerArgs": [],
    "compilerFragments": [
        "/DWIN32 /D_WINDOWS /EHsc /Zi /Ob0 /Od /RTC1 -std:c++20 -MDd"
    ]
}
cpptools version (native): 1.17.5.0
Translation Unit Mappings:
[ C:\Users\<redacted>\Desktop\issue\main.cpp ]:
    C:\Users\<redacted>\Desktop\issue\main.cpp
Translation Unit Configurations:
[ C:\Users\<redacted>\Desktop\issue\main.cpp ]:
    Process ID: 7152
    Memory Usage: 65 MB
    Compiler Path: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\bin\Hostx64\x64\cl.exe
    Includes:
        C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\include
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\winrt
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt
    Defines:
        WIN32
        _WINDOWS
    Standard Version: ms_c++20
    IntelliSense Mode: windows-msvc-x64
Total Memory Usage: 65 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 6354

IntelliSense process crash detected.
loggingLevel has changed to: Debug
LSP: cpptools/activeDocumentChange: file:///c%3A/Users/<redacted>/Desktop/issue/main.cpp
LSP: cpptools/textEditorSelectionChange
LSP: cpptools/getCodeActions: file:///c%3A/Users/<redacted>/Desktop/issue/main.cpp (id: 4327)
LSP: cpptools/textEditorSelectionChange
LSP: cpptools/getInlayHints: file:///c%3A/Users/<redacted>/Desktop/issue/main.cpp (id: 4328)
LSP: cpptools/getCodeActions: file:///c%3A/Users/<redacted>/Desktop/issue/main.cpp (id: 4329)
LSP: cpptools/getFoldingRanges: file:///c%3A/Users/<redacted>/Desktop/issue/main.cpp (id: 4330)
LSP: cpptools/textEditorSelectionChange
LSP: textDocument/willSaveWaitUntil: file:///c%3A/Users/<redacted>/Desktop/issue/main.cpp (id: 4331)
willSaveWaitUntil: 0ms
LSP: textDocument/didSave: file:///c%3A/Users/<redacted>/Desktop/issue/main.cpp
  tag parsing file: C:\Users\<redacted>\Desktop\issue\main.cpp
LSP: cpptools/fileChanged: file:///c%3A/Users/<redacted>/Desktop/issue/main.cpp
idle loop: reparsing the active document
Checking for syntax errors: C:\Users\<redacted>\Desktop\issue\main.cpp
Queueing IntelliSense update for files in translation unit of: C:\Users\<redacted>\Desktop\issue\main.cpp
Error squiggle count: 2
Update IntelliSense time (sec): 0.272
LSP: cpptools/getSemanticTokens: file:///c%3A/Users/<redacted>/Desktop/issue/main.cpp (id: 4332)
LSP: cpptools/getFoldingRanges: file:///c%3A/Users/<redacted>/Desktop/issue/main.cpp (id: 4333)
LSP: cpptools/textEditorSelectionChange
LSP: cpptools/getCodeActions: file:///c%3A/Users/<redacted>/Desktop/issue/main.cpp (id: 4334)
LSP: textDocument/willSaveWaitUntil: file:///c%3A/Users/<redacted>/Desktop/issue/main.cpp (id: 4335)
willSaveWaitUntil: 0ms
LSP: textDocument/didSave: file:///c%3A/Users/<redacted>/Desktop/issue/main.cpp
  tag parsing file: C:\Users\<redacted>\Desktop\issue\main.cpp
LSP: cpptools/fileChanged: file:///c%3A/Users/<redacted>/Desktop/issue/main.cpp
idle loop: reparsing the active document
Checking for syntax errors: C:\Users\<redacted>\Desktop\issue\main.cpp
Queueing IntelliSense update for files in translation unit of: C:\Users\<redacted>\Desktop\issue\main.cpp
Error squiggle count: 2
Update IntelliSense time (sec): 0.276
LSP: textDocument/hover: file:///c%3A/Users/<redacted>/Desktop/issue/main.cpp (id: 4336)
LSP: cpptools/getSemanticTokens: file:///c%3A/Users/<redacted>/Desktop/issue/main.cpp (id: 4337)
LSP: cpptools/getCodeActions: file:///c%3A/Users/<redacted>/Desktop/issue/main.cpp (id: 4338)
LSP: cpptools/getCodeActions: file:///c%3A/Users/<redacted>/Desktop/issue/main.cpp (id: 4339)
LSP: cpptools/getFoldingRanges: file:///c%3A/Users/<redacted>/Desktop/issue/main.cpp (id: 4340)
Other Extensions

None used.

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the crash with the provided main.cpp using the C++20 configuration and compare it with the version without lambdas. Review the IntelliSense crash and diagnostic output to identify the affected language-server path. Done means concepts containing lambdas no longer crash IntelliSense and report the correct result.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.