[LLVMbugs] [Bug 21888] New: clang-cl and cl disagree about the mangling of functions taking variadic templates

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Dec 11 19:18:17 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=21888

            Bug ID: 21888
           Summary: clang-cl and cl disagree about the mangling of
                    functions taking variadic templates
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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 at 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 at 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 at 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.

-- 
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/20141212/fc8634f3/attachment.html>


More information about the llvm-bugs mailing list