<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 --- - dllexport on class with in-class initializers causes error"
href="https://llvm.org/bugs/show_bug.cgi?id=23542">23542</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>dllexport on class with in-class initializers causes error
</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>Linux
</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>hans@chromium.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>$ bin/clang -target i386-pc-win32 -x c++ -c -
struct __declspec(dllexport) S {
int x = 42;
};
<stdin>:2:7: error: cannot use defaulted default constructor of 'S' within the
class outside of member functions because 'x' has an initializer
int x = 42;
^
<stdin>:1:30: note: implicit default constructor for 'S' first required here
struct __declspec(dllexport) S {
^
<stdin>:1:19: note: due to 'S' being dllexported
struct __declspec(dllexport) S {
^
1 error generated.
We're instantiating the default constructor due to the dllexport, and it
happens before we've parsed the in-class initializer.</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>