[PATCH] D15862: A possible direction for fixing https://llvm.org/bugs/show_bug.cgi?id=25973.
Tim Song via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 7 12:15:49 PST 2016
tcanens added inline comments.
================
Comment at: include/string:2826-2827
@@ -2787,13 +2825,4 @@
#endif
- size_type __old_sz = size();
- difference_type __ip = __pos - begin();
- for (; __first != __last; ++__first)
- push_back(*__first);
- pointer __p = __get_pointer();
- _VSTD::rotate(__p + __ip, __p + __old_sz, __p + size());
-#if _LIBCPP_DEBUG_LEVEL >= 2
- return iterator(this, __p + __ip);
-#else
- return iterator(__p + __ip);
-#endif
+ basic_string __temp(__first, __last, __alloc());
+ return insert(__pos, __temp.begin(), __temp.end());
}
----------------
This may cause infinite recursion if the allocator uses a fancy pointer (so that `__libcpp_string_gets_noexcept_iterator` returns `false`).
Perhaps `return insert(__pos, __temp.data(), __temp.data()+__temp.size());`?
http://reviews.llvm.org/D15862
More information about the cfe-commits
mailing list