<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </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 --- - clang-cl and cl disagree about the mangling of functions taking variadic templates"
   href="http://llvm.org/bugs/show_bug.cgi?id=21888">21888</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang-cl and cl disagree about the mangling of functions taking variadic templates
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>C++11
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>nicolasweber@gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This program fails to link if one half is compiled with clang-cl but the other
is compiled with cl:

C:\src\chromefetch\src> type tmp.cc
template <typename... Ts>
struct Tuple {
  Tuple() {}
};
using Tuple0 = Tuple<>;

class Message;

class SyncChannelTestMsg_AnswerToLife {
 public:                                                                    
  static bool ReadSendParam(const Message* msg, Tuple0* p);      
};

#ifdef FOO
  bool SyncChannelTestMsg_AnswerToLife::ReadSendParam(
      const Message* msg, Tuple0* p) {
    return true;
  }
#else
int main() {
  SyncChannelTestMsg_AnswerToLife::ReadSendParam(nullptr, nullptr);
}
#endif


C:\src\chromefetch\src>cl tmp.cc /DFOO /c
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.21005.1 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

tmp.cc

C:\src\chromefetch\src>..\..\llvm-rw-build-rel\bin\clang-cl.exe tmp.cc /c
/Fotmp2.obj

C:\src\chromefetch\src>cl /Fetmp.exe tmp.obj tmp2.obj
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.21005.1 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 12.00.21005.1
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:tmp.exe
tmp.obj
tmp2.obj
tmp2.obj : error LNK2019: unresolved external symbol "public: static bool
__cdecl SyncChannelTestMsg_AnswerToLife::ReadSendParam(class Message const
*,struct Tuple<> *)"
(?ReadSendParam@SyncChannelTestMsg_AnswerToLife@@SA_NPBVMessage@@PAU?$Tuple@$$V@@@Z)
referenced in function _main
tmp.exe : fatal error LNK1120: 1 unresolved externals

C:\src\chromefetch\src>cl.exe tmp.cc /c /Fotmp2.obj
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.21005.1 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

tmp.cc

C:\src\chromefetch\src>cl /Fetmp.exe tmp.obj tmp2.obj
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.21005.1 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 12.00.21005.1
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:tmp.exe
tmp.obj
tmp2.obj




// cl /DFOO:
// tmp2.obj : error LNK2019: unresolved external symbol "public: static bool
__cdecl SyncChannelTestMsg_AnswerToLife::ReadSendParam(class Message const *
// ,struct Tuple<> *)"
(?ReadSendParam@SyncChannelTestMsg_AnswerToLife@@SA_NPBVMessage@@PAU?$Tuple@$$V@@@Z)
referenced in function _main

// clang-cl /DFOO:
// tmp1.obj : error LNK2019: unresolved external symbol "public: static bool
__cdecl SyncChannelTestMsg_AnswerToLife::ReadSendParam(class Message const *
// ,struct Tuple<> *)"
(?ReadSendParam@SyncChannelTestMsg_AnswerToLife@@SA_NPBVMessage@@PAU?$Tuple@$$$V@@@Z)
referenced in function _main


Note how clang produces $$V@@@Z while cl produces $$$V@@@Z -- cl has more
trailing dollars.</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>