Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

templated type alias not recognized #1449

Open
jobor opened this issue Apr 16, 2024 · 0 comments
Open

templated type alias not recognized #1449

jobor opened this issue Apr 16, 2024 · 0 comments

Comments

@jobor
Copy link

jobor commented Apr 16, 2024

Consider the following code

template<typename T>
struct Foo
{
};

template<typename T> using Bar = Foo<T>;

int main()
{
    Foo<int> foo = {};
    Bar<int> bar = {};
    // break here and hover over foo and bar.
    return 0;
}

with this natvis file

<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
    <Type Name="Foo&lt;*&gt;">
        <DisplayString>this is a Foo</DisplayString>
    </Type>
</AutoVisualizer>

then cppdbg with gcc on Linux will be able to display the content of foo as this is a Foo, but it displays the default visualizer for bar.

Expected result: display this is a Foo for bar as well.

Adding <AlternativeType Name="Bar&lt;*&gt;"> to the Foo type does not work.

Adding a separate <Type Name="Bar&lt;*&gt;"> does not work.

Adding a separate <Type Name="Bar"> does work. However, I loose the information about the template parameters. I can't access $T1 anymore.

Side note / trivia: with cppvsdbg, this is a Foo is displayed for bar - also if the entry for Bar is missing in the natvis file.

More trivia: this contrived example stems from an attempt to display Qt's type QVector which is defined as template <typename T> using QVector = QList<T>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant