Skip to content

Struct with struct members displays incorrectly #656

@shamilton801

Description

@shamilton801

When I step into a function that takes a struct with multiple struct members, the watch/local/hover window fails to display the information correctly.

I've created a small example program that demonstrates the issue. Note that the struct displays correctly in the scope it's created, but when I step into f1 the watch window shows garbage.

#include <windows.h>

struct Bar1 {
    int a;
};

struct Bar2 {
    int b;
};

struct Foo {
    Bar1 b1;
    Bar2 b2;
    int c;
};

void f2(Foo f) {
    OutputDebugStringA("f2");
}

void f1(Foo f) {
    f2(f);
    OutputDebugStringA("f1");
}

int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) {
    Foo foo = {};
    foo.b1.a = 1;
    foo.b2.b = 2;
    foo.c = 3;

    f1(foo);
    return 0;
}
Image Image Image

Compilation command: cl main.cpp -Od -ZI
MSVC version: Version 19.44.35216 for x64
Debugger version: 0.9.22 ALPHA

Am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions