microsoft / microsoft/vscode-cpptools
Concept always fails when it has lambda inside it
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Environment
- OS and Version: Windows 11 Dev Channel
- VS Code Version: 1.109.~
- C/C++ Extension Version: 1.30.3
- If using SSH remote, specify OS of remote machine: ``
Bug Summary and Steps to Reproduce
Bug Summary:
If a concept has lambda, it'll always fail. For example
template <typename T>
concept HasField = requires { []() { return int(1); }(); };
will fail even though its valid in C++23 and should pass. I tried all the possible scenarios I could think of, and indeed its the lambda that causes this bug. Even an empty lambda will fail:
template <typename T>
concept HasField = requires { [](){}(); };
Note that this is valid in all gcc, clang and msvc.
Steps to reproduce:
- Write one the following test:
template <typename T>
concept HasField = requires { []() {}(); };
template <typename T>
requires HasField<T>
consteval void Test()
{
}
int main()
{
Test<int>();
}
- Wait for the intellisense error report on the
Test<int>()with the following details:
[{
"resource": "[PATH_TO_FILE]",
"owner": "C/C++: IntelliSense",
"code": "304",
"severity": 8,
"message": "no instance of function template \"Test\" matches the argument list",
"source": "C/C++",
"startLineNumber": 12,
"startColumn": 5,
"endLineNumber": 12,
"endColumn": 9,
"modelVersionId": 650,
"origin": "extHost1"
}]
Expected behavior:
Configuration and Logs
-------- Diagnostics - 2/3/2026, 11:45:49 AM
Version: 1.30.3
Current Configuration:
{
"name": "Win32",
"includePath": [
"e:/source/TestGame/**"
],
"windowsSdkVersion": "10.0.26100.0",
"compilerPath": "cl.exe",
"cStandard": "c23",
"cppStandard": "c++23",
"configurationProvider": "ms-vscode.cmake-tools",
"compileCommands": [
"EDITED_PATH\\compile_commands.json"
],
"compilerPathIsExplicit": true,
"cStandardIsExplicit": true,
"cppStandardIsExplicit": true,
"intelliSenseModeIsExplicit": true,
"recursiveIncludesReduceIsExplicit": false,
"recursiveIncludesPriorityIsExplicit": false,
"recursiveIncludesOrderIsExplicit": false,
"compilerPathInCppPropertiesJson": "cl.exe",
"compileCommandsInCppPropertiesJson": [
"build\\compile_commands.json"
],
"configurationProviderInCppPropertiesJson": "ms-vscode.cmake-tools",
"mergeConfigurations": false,
"recursiveIncludes": {},
"browse": {
"limitSymbolsToIncludedHeaders": true
}
}
Modified Settings:
{
"C_Cpp.intelliSenseUpdateDelay": 500,
"C_Cpp.autocompleteAddParentheses": true,
"C_Cpp.legacyCompilerArgsBehavior": true,
"C_Cpp.autocomplete": "disabled",
"C_Cpp.errorSquiggles": "enabled",
"C_Cpp.workspaceSymbols": "All",
"C_Cpp.doxygen.generatedStyle": "/**",
"C_Cpp.codeAnalysis.updateDelay": 100,
"C_Cpp.codeAnalysis.clangTidy.enabled": true,
"C_Cpp.codeAnalysis.clangTidy.useBuildPath": true,
"C_Cpp.vcpkg.enabled": false,
"C_Cpp.experimentalFeatures": "enabled"
}
Additional Tracked Settings:
{
"editorTabSize": 4,
"editorInsertSpaces": true,
"editorAutoClosingBrackets": "languageDefined",
"filesEncoding": "utf8",
"filesAssociations": {},
"filesExclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/.DS_Store": true,
"**/Thumbs.db": true
},
"filesAutoSaveAfterDelay": false,
"editorInlayHintsEnabled": true,
"editorParameterHintsEnabled": true,
"searchExclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true
},
"workbenchSettingsEditor": "ui"
}
Custom browse configuration:
{
"browsePath": [
"EDITED_PATH",
"EDITED_PATH",
"EDITED_PATH",
"EDITED_PATH"
],
"compilerPath": "c:/program files/llvm/bin/clang-cl.exe",
"compilerArgs": [],
"compilerFragments": [
"/DWIN32 /D_WINDOWS /W3 /GR /EHsc /EHs- /MDd /Zi /Ob0 /Od /RTC1 -clang:-std=c++23"
]
}
cpptools version (native): 1.30.2.0
Current database path: C:\USERS\EDITED_PATH\APPDATA\LOCAL\MICROSOFT\VSCODE-CPPTOOLS\9DE1C39CDBB89B84DFD146C5CE357290\.BROWSE.VC.DB
Translation Unit Mappings:
[ EDITED_PATH.cpp - source TU]:
EDITED_PATH
Translation Unit Configurations:
[ EDITED_PATH.cpp ]
Process ID: 22292
Memory Usage: 421 MB
Compiler Path: C:\Program Files\LLVM\bin\clang-cl.exe
Include paths:
include: EDITED_PATH
include: EDITED_PATH
include: EDITED_PATH
system include: C:\Program Files\LLVM\lib\clang\21\include
system include: C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools\VC\Tools\MSVC\14.50.35717\include
system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt
system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\shared
system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um
system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\winrt
system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\cppwinrt
Defines:
WIN32
_WINDOWS
Standard Version: c++23
IntelliSense Mode: windows-clang-x64
Other Flags:
--clang
--clang_version=210108
--ms_compatibility
Total Memory Usage: 421 MB
Browse Paths from compile_commands.json, from workspace folder: EDITED_PATH
C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools\VC\Tools\MSVC\14.50.35717\include
C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\cppwinrt
C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\shared
C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt
C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um
C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\winrt
C:\Program Files\LLVM\lib\clang\21\include
------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 5423
Other Extensions
No response
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported C++23 concept with an immediately invoked lambda and compare IntelliSense diagnostics with the compiler behavior described in the issue. The work is done when both minimal examples are accepted and the Test() call no longer reports that no function template instance matches.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100