https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67752

            Bug ID: 67752
           Summary: In a template instantiation containing
                    sizeof...(ArgPack), the mangling for
                    sizeof(ArgPack...) is emitted instead
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: andrey.vul at gmail dot com
  Target Milestone: ---

Given

// begin a.cc
int RC = 66;
template <class C, C c, C ... I> void f(C * (*&&)[sizeof...(I)]) { RC = 55; }
template void f<int, 2, 1, 2>(int * (*&&)[2]);
// end a.cc

, `g++ -std=c++11 a.cc -S -o -|grep ^_Z1` gives us the mangled name:

_Z1fIiLi2EILi1ELi2EEEvOPAszspT1__PT_

Note the use of "szsp".

In clang, it mangles as

_Z1fIiLi2EILi1ELi2EEEvOPAsZT1__PT_

Note the "sZ"

By C++ABI, clang is right since we encode sizeof...(I) not sizeof(I...).

c++filt shows us that indeed the latter is encoded:
void f<int, 2, 1, 2>(int* (*&&) [sizeof (1, 2)]):

Note: c++filt can't be used on clang output since binutils libbfd
cplus_demangle doesn't support "sZ" mangle (yet -- tested on 2.25).

Reply via email to