Open
Description
Environment
- OS and Version: Windows 10 Pro, 10.0.19045
- VS Code Version: 1.99.3
- C/C++ Extension Version: 1.24.5
- If using SSH remote, specify OS of remote machine: N/A
Bug Summary and Steps to Reproduce
Bug Summary:
When formatting with the default VSCode formatter, custom binary multiply operators are formatted as unary operators.
Steps to reproduce:
struct A { int value; };
int operator+(const A& left, const A& right) { return left.value + right.value; }
int operator*(const A& left, const A& right) { return left.value * right.value; }
int main()
{
auto result = A{ 3 } + A{ 5 }; // Correct
auto result = A{ 3 } *A{ 5 }; // Incorrect (VSCode formatter formats binary operator as unary)
}
Expected behavior:
int main()
{
auto result = A{ 3 } + A{ 5 };
auto result = A{ 3 } * A{ 5 };
}
Configuration and Logs
-------- Diagnostics - 4/27/2025, 10:59:19 PM
Version: 1.24.5
Current Configuration:
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"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,
"recursiveIncludes": {
"reduce": "default",
"priority": "afterSystemIncludes",
"order": "depthFirst"
},
"compilerPathIsExplicit": false,
"browse": {
"limitSymbolsToIncludedHeaders": true
}
}
Modified Settings:
{
"C_Cpp.vcFormat.indent.accessSpecifiers": true,
"C_Cpp.formatting": "vcFormat"
}
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"
}
cpptools version (native): 1.24.5.0
Current database path: C:\USERS\TEST\APPDATA\LOCAL\TEMP\{BF92AA07-4564-420A-8B97-93EF3AA9C2E6}\.BROWSE.VC.DB
Translation Unit Mappings:
[ D:\main.cpp - source TU]:
Translation Unit Configurations:
[ D:\main.cpp ]
Process ID: 7852
Memory Usage: 50 MB
Compiler Path: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\bin\Hostx64\x64\cl.exe
Include paths:
system include: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include
system include: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\atlmfc\include
system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um
system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt
system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared
system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\winrt
system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt
Defines:
_DEBUG
UNICODE
_UNICODE
Standard Version: ms_c++17
IntelliSense Mode: windows-msvc-x64
Total Memory Usage: 50 MB
------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 4887
Other Extensions
No response
Additional context
No response