[llvm-bugs] [Bug 27066] New: [ms] __declspec(dllexport) causes redefinition with same mangled name as another definition

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Mar 25 04:44:17 PDT 2016


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

            Bug ID: 27066
           Summary: [ms] __declspec(dllexport) causes redefinition with
                    same mangled name as another definition
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: andrey.kuleshov at intel.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

!- This problem is related to dllexport. MSVC compiles sample described below.

Note that even if clang's behavior is correct, compiler's diagnostic is not
usable:
error: definition with same mangled name as another definition
class A {}; (why class A is redefined?)

note: previous definition is here: <no line> (where is the line with the
previous definition?) -!

==========Small Reproducer==============
typedef struct _GUID { int i; } ID;

template <const ID* piid>
class A {};

struct
__declspec(uuid("{00000000-0000-0000-c000-000000000046}"))
S1 {};

struct
__declspec(uuid("{00000000-0000-0000-c000-000000000046}"))
S2 {};

struct __declspec(dllexport)
C1 : public A <&__uuidof(S1)>
{};

struct __declspec(dllexport)
C2 : public A<&__uuidof(S2)>
{};

==============Error=====================
>>>clang:
test.cpp(4,7) :  error: definition with same mangled name as another definition
class A {};
      ^
test.cpp(4,7) :  note: previous definition is here
1 error generated.

>>>MSVC:
  Creating library test.lib and object test.exp


Andrey Kuleshov
======
Software Engineer
Intel Compiler Team

-- 
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/20160325/904d362b/attachment.html>


More information about the llvm-bugs mailing list