<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 - clang-cl fails with default member initializer outside member functions"
href="https://bugs.llvm.org/show_bug.cgi?id=37235">37235</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang-cl fails with default member initializer outside member functions
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>steveire@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Building a shared library with the following content fails:
#pragma once
#ifndef EXPORT
# if defined(DLL_BUILD)
# define EXPORT __declspec(dllexport)
# else // Being used in a non Engine dll build, but still a dll use,
so import
# define EXPORT __declspec(dllimport)
# endif
#endif
/// The rule that produces an input mapping
class EXPORT A
{
public:
struct EXPORT Value
{
int m_mem = 0;
};
template <class T>
struct TypedValue : public Value
{
};
struct EXPORT BoolValue : TypedValue<bool>
{
};
};
With the following error:
C:\dev\src\playground\cpp\shlib.cpp(24,32): error : default member
initializer for 'm_mem' needed within de finition of enclosing class 'A'
outside of member functions
[C:\dev\src\playground\cpp\clangcl\clangcllink.vcxproj]
struct TypedValue : public Value
^
C:\dev\src\playground\cpp\shlib.cpp(28,31): note: in instantiation of
template class 'A::TypedValue<bool
>' requested here
struct EXPORT BoolValue : TypedValue<bool>
^
C:\dev\src\playground\cpp\shlib.cpp(20,13): note: default member
initializer declared here
int m_mem = 0;
^
C:\dev\src\playground\cpp\shlib.cpp(28,12): note: due to 'TypedValue'
being dllexported
struct EXPORT BoolValue : TypedValue<bool>
^
C:\dev\src\playground\cpp\shlib.cpp(6,38): note: expanded from macro
'EXPORT'
# define EXPORT __declspec(dllexport)
^
1 warning and 1 error generated.</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>