<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Compilation error on Windows due to Microsoft export rules"
href="https://bugs.llvm.org/show_bug.cgi?id=42784">42784</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Compilation error on Windows due to Microsoft export rules
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>7.0
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Backend: X86
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ravi.kappiyoor@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>craig.topper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, spatel+llvm@rotateright.com
</td>
</tr></table>
<p>
<div>
<pre>This is more of an enhancement request than a bug (the bug is in Microsoft
export standards)...
The following code compiles correctly with clang++ on Linux. Under Windows, it
fails with an error message that the dynamic_cast failed because "D *" is not a
valid class name.
#include <list>
#include <type_traits>
class A {};
class B : public A
{
public:
std::list<A *> _a;
};
class D : public A {};
template <class T>
class C : public B
{
static_assert(std::is_base_of<A, T>::value, "T must inherit from A!");
T * const * func() const
{
return dynamic_cast<T * const *>(_a.empty() ? nullptr : &(*_a.cbegin()));
}
};
template <class T>
class E : public C<T> {};
class __declspec(dllexport) F : public E<D> {};
We get the same output when compiling this on Windows with any modern compiler
- Intel, Clang++, or MSVC (hence the remark about the issue being with
Microsoft export requirements instead of with Clang++). However, Intel has a
custom flag that they have provided us in the past
(/Qoption,cpp,--suppress_base_class_export) that allows this code to compile
normally. The enhancement request, then, is: Can Clang++ please have a similar
flag for this, too?</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>