[llvm-bugs] [Bug 38783] New: MS Mangler should insert a parameter pack separator

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 30 13:43:57 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38783

            Bug ID: 38783
           Summary: MS Mangler should insert a parameter pack separator
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zturner at google.com
                CC: david.majnemer at gmail.com, llvm-bugs at lists.llvm.org,
                    rnk at google.com

Consider this code:

template<typename... As, typename... Bs>
int func(As..., Bs...);

int main(int argc, char **argv) {
  func<int, int, int>(1, 2, 3, 4, 5, 6);
  func<int, int>(1, 2, 3, 4, 5, 6);
}

There are several ways to deduce the types of parameter packs when there are
multiple packs in the same template parameter list.  In this case, the rule
that is used is that if some of the template arguments are explicitly
specified, the first parameter pack gets those, and the second parameter pack
gets everything else.

So, in the first instantiation of func, As = {1, 2, 3}, Bs = {4, 5, 6}.  And in
the second instantiation of func, As = {1, 2} and Bs = {3, 4, 5, 6}.

If you run this with cl, MSVC generates these two manglings:

00B 00000000 UNDEF  notype ()    External     | ??$func at HHH$$ZHHH@@YAHHHHHHH at Z
(int __cdecl func<int,int,int,int,int,int>(int,int,int,int,int,int))
00C 00000000 UNDEF  notype ()    External     | ??$func at HH$$ZHHHH@@YAHHHHHHH at Z
(int __cdecl func<int,int,int,int,int,int>(int,int,int,int,int,int))

But clang-cl mangles both of them the same, as:

??$func at HHHHHH@@YAHHHHHHH at Z (int __cdecl
func<int,int,int,int,int,int>(int,int,int,int,int,int))

We need to insert this $$Z parameter pack separator between any two adjacent
parameter packs.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180830/327394d3/attachment.html>


More information about the llvm-bugs mailing list