<html>
<head>
<base href="http://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 --- - set: default construction does not work properly"
href="http://llvm.org/bugs/show_bug.cgi?id=15724">15724</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>set: default construction does not work properly
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</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>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>hhinnant@apple.com
</td>
</tr>
<tr>
<th>Reporter</th>
<td>akim.demaille@gmail.com
</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>In the following piece of code, if I understand correctly libc++'s own header
(the initial "Synopsis" section), there is:
set()
noexcept(
is_nothrow_default_constructible<allocator_type>::value &&
is_nothrow_default_constructible<key_compare>::value &&
is_nothrow_copy_constructible<key_compare>::value);
explicit set(const value_compare& comp);
i.e., the default constructor is not flagged with explicit.
Yet, the following piece of code does not work, because there is no default
constructor: its functionality is provided by the following (explicit)
unary-constructor whose argument is optional. So clang rejects the following
piece of code.
$ cat /tmp/set.cc
#include <set>
int
main()
{
std::set<int> s = {};
}
$ clang++-mp-3.3 -std=c++11 -Wall /tmp/set.cc -stdlib=libc++
/tmp/set.cc:5:17: error: chosen constructor is explicit in copy-initialization
std::set<int> s = {};
^ ~~
/opt/local/libexec/llvm-3.3/bin/../lib/c++/v1/set:378:14: note: constructor
declared here
explicit set(const value_compare& __comp = value_compare())
^
1 error generated.
$ g++-mp-4.8 -std=c++11 -Wall /tmp/set.cc</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>