<html>
<head>
<base href="https://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 --- - [ms] __declspec(dllexport) causes redefinition with same mangled name as another definition"
href="https://llvm.org/bugs/show_bug.cgi?id=27066">27066</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[ms] __declspec(dllexport) causes redefinition with same mangled name as another definition
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>andrey.kuleshov@intel.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>!- 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=====================
<span class="quote">>>>clang:</span >
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.
<span class="quote">>>>MSVC:</span >
Creating library test.lib and object test.exp
Andrey Kuleshov
======
Software Engineer
Intel Compiler Team</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>