-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Copy link
Labels
bugdebuggerfixedCheck the Milestone for the release in which the fix is or will be available.Check the Milestone for the release in which the fix is or will be available.
Milestone
Description
Environment
- OS and version: Ubuntu 22.04.3 LTS (WSL2)
- VS Code: 1.87.2
- C/C++ extension: 1.19.8
- GDB / LLDB version: 12.1
Bug Summary and Steps to Reproduce
Bug Summary:
When an std::map is instantiated with an enum class as the key and a struct as a value, the map displays "improperly" in the watch or local window, meaning that the key does not render properly. An std::map<int, struct> or std::map<enum, int> displays as expected.
Steps to reproduce:
Minimum reproducible example:
#include <map>
enum class foo {A, B};
struct bar {
int x = 5;
int y = 6;
};
int main(int argc, char * argv[]) {
std::map<foo, bar> m1;
std::map<foo, int> m2;
std::map<int, bar> m3;
m1[foo::A] = bar();
m1[foo::B] = bar();
m2[foo::A] = 0;
m2[foo::B] = 0;
m3[0] = bar();
return 0;
}
Compile and check view m1, m2, and m3 in watch or local window.

Debugger Configurations
tasks.json:
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++ build active file",
"command": "/usr/bin/g++",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "compiler: /usr/bin/g++"
}
]
}
launch.json
{
"version": "2.0.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/test",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
}
Debugger Logs
--Other Extensions
No response
Additional Information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugdebuggerfixedCheck the Milestone for the release in which the fix is or will be available.Check the Milestone for the release in which the fix is or will be available.
Type
Projects
Status
Done