<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - MS Mangler should insert a parameter pack separator"
   href="https://bugs.llvm.org/show_bug.cgi?id=38783">38783</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>MS Mangler should insert a parameter pack separator
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>zturner@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>david.majnemer@gmail.com, llvm-bugs@lists.llvm.org, rnk@google.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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@HHH$$ZHHH@@YAHHHHHHH@Z
(int __cdecl func<int,int,int,int,int,int>(int,int,int,int,int,int))
00C 00000000 UNDEF  notype ()    External     | ??$func@HH$$ZHHHH@@YAHHHHHHH@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@HHHHHH@@YAHHHHHHH@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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>