[Bug c++/59457] New: name mangling in presence of variadic templates seems wrong

plasmahh at gmx dot net gcc-bugzilla@gcc.gnu.org
Tue Dec 10 20:46:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59457

            Bug ID: 59457
           Summary: name mangling in presence of variadic templates seems
                    wrong
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: plasmahh at gmx dot net

With the program below, the output is

1hI1AI2hhIiEEE
h<A<hh<int> > >
h<A, hh<int> >

where the "h<A, hh<int> >" part is from my "hand-mangled" idea how it should
look like. It seems to be only present when variadic templates are there, e.g.
when you replace class... with class, it goes away. Clang btw. seems to mangle
it correctly, that is with J in place of I.


    #include <iostream>
    #include <typeinfo>
    #include <cxxabi.h>

    struct A{};
    template<class,class...> struct h{};
    template<class> struct hh{};
    int main() {
    typedef h<A,hh<int>> hx;
    const char* name = typeid(hx).name();
    std::cout << name << "\n";
    char db[4096];
    size_t size = 4096;
    int st;
    abi::__cxa_demangle(name,db,&size,&st);
    std::cout << db << "\n";
    // now what I think the symbol should look like (exchange
    abi::__cxa_demangle("1hI1AJ2hhIiEEE",db,&size,&st);
    std::cout << db << "\n";
    return 0;
    }



More information about the Gcc-bugs mailing list