<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 --- - operator= for std::map violates the standard"
href="https://llvm.org/bugs/show_bug.cgi?id=29001">29001</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>operator= for std::map violates the standard
</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>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>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>furkanusta17@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>std::map's operator= violates the standard when
propagate_on_container_copy_assignment is true and allocators do not compare
equal
Code: <a href="http://melpon.org/wandbox/permlink/uPR3u5fYkUx2In4k">http://melpon.org/wandbox/permlink/uPR3u5fYkUx2In4k</a>
I couldn't find where in the standard it states but in cppreference operator=
for std::map says that
If
std::allocator_traits<allocator_type>::propagate_on_container_copy_assignment()
is true, the target allocator is replaced by a copy of the source allocator. If
the target and the source allocators do not compare equal, the target (*this)
allocator is used to deallocate the memory, then other's allocator is used to
allocate it before copying the elements.
Although in the example it doesn't even allocate, I guess it is because there
is
some sort of caching system, in the code it does
__copy_assign_alloc(__t);
__assign_multi(__t.begin(), __t.end());
Then caches the nodes to be deleted in __assign_multi, but allocator already
changes in __copy_assign_alloc</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>