<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 --- - std::is_default_constructible deletes default constructor"
href="https://llvm.org/bugs/show_bug.cgi?id=25880">25880</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>std::is_default_constructible deletes default constructor
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.7
</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>juri.valdmann@gmail.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>Hello,
I've ran into an interesting issue, where, under certain circumstances,
evaluating std::is_default_constructible<T>::value has the unexpected
side-effect of seemingly deleting T's implicit default constructor.
Here is a minimized test case
#include <type_traits>
struct Helper
{
Helper() {}
// one of the following two is required
Helper(const Helper &) {}
Helper(Helper &&) {}
};
struct Outer
{
struct Inner
{
int x = 0;
};
Helper x;
Inner y;
Outer() {}
// this has to be inside Outer (i.e. not global)
static const bool delete_ctor_of_Inner =
std::is_default_constructible<Inner>::value;
};
int main() {}
With both clang 3.6.2 and 3.7.0 the following error output is generated:
$ clang -std=c++14 test.cpp
test.cpp:21:5: error: constructor for 'Outer' must explicitly initialize
the member 'y' which does not have a default constructor
Outer() {}
^
test.cpp:19:11: note: member is declared here
Inner y;
^
test.cpp:13:12: note: 'Outer::Inner' declared here
struct Inner
^
1 error generated.
The libstdc++ is from GCC 4.9.2. With clang 3.5.0 it works.
Cheers,
Jüri Valdmann</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>