Skip to content

Wrong colorization because of lambda return type with default Intelli Sense Engine #11204

@aandrejevas

Description

@aandrejevas

Environment

  • OS and Version: Windows_NT x64 10.0.19045
  • VS Code Version: 1.80.1
  • C/C++ Extension Version: v1.16.3

Bug Summary and Steps to Reproduce

Settings:

"C_Cpp.default.cppStandard": "c++23",
"C_Cpp.default.cStandard": "c17",
"C_Cpp.default.intelliSenseMode": "windows-gcc-x64",
"C_Cpp.default.compilerPath": "C:\\msys64\\ucrt64\\bin\\g++.exe",
"C_Cpp.autoAddFileAssociations": false,
"C_Cpp.suggestSnippets": false,
"C_Cpp.formatting": "vcFormat",
"C_Cpp.vcpkg.enabled": false,
"C_Cpp.default.defines": [],
"C_Cpp.intelliSenseCacheSize": 16384,
"C_Cpp.loggingLevel": "Debug",
"C_Cpp.simplifyStructuredComments": false,
"C_Cpp.errorSquiggles": "disabled",
"C_Cpp.codeAnalysis.runAutomatically": false,
"C_Cpp.dimInactiveRegions": false,

Bug Summary:
The following code is colorized incorrectly. It seems additional tokens are incorrectly interpreted as lambda return type.

#include <cstdio>

int main() {
	const auto lambda = []() -> const char *{
		return "Hello world!\n";
	};

	std::printf(lambda());
}

Screenshots:
image
image
Expected colorization
image

Configuration and Logs

LSP: cpptools/textEditorSelectionChange
LSP: textDocument/didOpen: file:///c%3A/Users/Aleksandras/Desktop/projects/QAP_BA/src/test.cpp
Checking for syntax errors: C:\Users\Aleksandras\Desktop\projects\QAP_BA\src\test.cpp
LSP: cpptools/activeDocumentChange: file:///c%3A/Users/Aleksandras/Desktop/projects/QAP_BA/src/test.cpp
Queueing IntelliSense update for files in translation unit of: C:\Users\Aleksandras\Desktop\projects\QAP_BA\src\test.cpp
LSP: cpptools/getCodeActions: file:///c%3A/Users/Aleksandras/Desktop/projects/QAP_BA/src/test.cpp (id: 8)
LSP: cpptools/getDocumentSymbols: file:///c%3A/Users/Aleksandras/Desktop/projects/QAP_BA/src/test.cpp (id: 9)
LSP: cpptools/textEditorSelectionChange
LSP: cpptools/getSemanticTokens: file:///c%3A/Users/Aleksandras/Desktop/projects/QAP_BA/src/test.cpp (id: 10)
LSP: cpptools/getInlayHints: file:///c%3A/Users/Aleksandras/Desktop/projects/QAP_BA/src/test.cpp (id: 11)
Error squiggle count: 0
Update IntelliSense time (sec): 0.282

Other Extensions

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions