diff options
| author | Eric Fiselier <eric@efcs.ca> | 2017-04-15 06:49:02 +0000 |
|---|---|---|
| committer | Eric Fiselier <eric@efcs.ca> | 2017-04-15 06:49:02 +0000 |
| commit | e84fcb5f3d49761076b99c08ba9e13a519dfac4b (patch) | |
| tree | 64e68e6a25d69845de589ff778c8eed3e2ada7c2 /libcxx/include/string | |
| parent | 4d53a1cb31c4950b2a30af3f4f6148f7216ffd92 (diff) | |
| download | bcm5719-llvm-e84fcb5f3d49761076b99c08ba9e13a519dfac4b.tar.gz bcm5719-llvm-e84fcb5f3d49761076b99c08ba9e13a519dfac4b.zip | |
Fix PR32642 - string::insert and string::append don't work with move_iterator.
llvm-svn: 300397
Diffstat (limited to 'libcxx/include/string')
| -rw-r--r-- | libcxx/include/string | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libcxx/include/string b/libcxx/include/string index 6f9c19fe803..1bc91ed1249 100644 --- a/libcxx/include/string +++ b/libcxx/include/string @@ -2276,7 +2276,9 @@ basic_string<_CharT, _Traits, _Allocator>::__append_forward_unsafe( size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last)); if (__n) { - if ( __ptr_in_range(&*__first, data(), data() + size())) + typedef typename iterator_traits<_ForwardIterator>::reference _CharRef; + _CharRef __tmp_ref = *__first; + if (__ptr_in_range(_VSTD::addressof(__tmp_ref), data(), data() + size())) { const basic_string __temp (__first, __last, __alloc()); append(__temp.data(), __temp.size()); @@ -2440,7 +2442,9 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _Forward size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last)); if (__n) { - if ( __ptr_in_range(&*__first, data(), data() + size())) + typedef typename iterator_traits<_ForwardIterator>::reference _CharRef; + _CharRef __tmp_char = *__first; + if (__ptr_in_range(_VSTD::addressof(__tmp_char), data(), data() + size())) { const basic_string __temp(__first, __last, __alloc()); return insert(__pos, __temp.data(), __temp.data() + __temp.size()); |

