Skip to content

templated type alias not recognized #1449

Description

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>.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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