<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 --- - shared_ptr issues when allocator/deleter have throwing move constructor"
href="https://llvm.org/bugs/show_bug.cgi?id=27556">27556</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>shared_ptr issues when allocator/deleter have throwing move constructor
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>klemensbaum@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>There seems to be an issue in the shared_ptr implementation if the move
constructor of the deleter and/or allocator throw an exception. The standard
only guarantees that the copy constructor of the allocator and deleter may not
throw, nothing in there talks about move constructors.
In <memory>, line 4185, the allocator and deleter get passed into the _CntrlBlk
aka __shared_ptr_pointer by copy, which is fine and will not throw (note:
instead of always copying, we could use std::move_if_noexcept here).
The __shared_ptr_pointer constructor hands off the deleter and allocator into
the __compressed_pair by unconditional move (!). This can throw, and at line
4191, __d could already be moved-from or partially moved-from.
I think these calls to std::move should be replaced with std::move_if_noexcept.
There are more move constructors being invoked inside __compressed_pair, which
will also need to get looked at.
Line numbers refer to SVN revision 267901.</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>