<html>
<head>
<base href="http://bugs.llvm.org/">
</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 - string::insert and append no longer work with move_iterator"
href="http://bugs.llvm.org/show_bug.cgi?id=32642">32642</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>string::insert and append no longer work with move_iterator
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>4.0
</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>officesamurai@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>Test code:
#include <string>
template <typename Collection>
void insert(Collection& dest, Collection src, size_t pos)
{
dest.insert(std::next(dest.begin(), pos),
std::make_move_iterator(src.begin()), std::make_move_iterator(src.end()));
}
int main()
{
std::string s1, s2;
insert(s1, std::move(s2), 0);
}
The command line and the result:
~/tmp$ clang++-4.0 test.cpp -std=c++11 -stdlib=libc++ -o test
In file included from test.cpp:1:
/home/brd/soft/clang+llvm-4.0.0-x86_64-linux-gnu-ubuntu-14.04/bin/../include/c++/v1/string:2409:29:
error: cannot take the address of an rvalue of type 'char'
if ( __ptr_in_range(&*__first, data(), data() + size()))
^~~~~~~~~
test.cpp:6:10: note: in instantiation of function template specialization
'std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char>
<span class="quote">>::insert<std::__1::move_iterator<std::__1::__wrap_iter<char *> > >' requested</span >
here
dest.insert(std::next(dest.begin(), pos),
std::make_move_iterator(src.begin()), std::make_move_iterator(src.end()));
^
test.cpp:12:5: note: in instantiation of function template specialization
'insert<std::__1::basic_string<char> >' requested here
insert(s1, std::move(s2), 0);
^
1 error generated.</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>