<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 --- - Clang sometimes does not properly link classes inherited from dllimported classes"
href="https://llvm.org/bugs/show_bug.cgi?id=31826">31826</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang sometimes does not properly link classes inherited from dllimported classes
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.9
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>other
</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>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>marc@groundctl.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>Code is as follows:
==> x.cpp <==
#define DECL __declspec(dllexport)
#include "header.h"
==> y.cpp <==
#define DECL __declspec(dllimport)
#include "header.h"
int main() {
t2 s;
}
==> header.h <==
struct DECL t {
virtual void fun() = 0;
};
struct t2 : t {
virtual void fun() {}
};
When using mingw64 6.2, if x.cpp is compiled as x.dll and y.cpp is compiled as
an executable linking x.dll, the linker fails with undefined references to
`_imp___ZTV1t' and `typeinfo for t'. This code works fine with both gcc 6.2
and Visual Studio 2015.
Adding a virtual function to t defined in x.cpp causes this issue to go away.</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>