[PATCH] D29863: [libc++] Fix PR 31938 - std::basic_string constructors use non-deductible parameter types.
Richard Smith via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 12 13:02:16 PST 2017
rsmith added inline comments.
================
Comment at: include/string:782
_LIBCPP_INLINE_VISIBILITY
basic_string(const value_type* __s, size_type __n);
_LIBCPP_INLINE_VISIBILITY
----------------
EricWF wrote:
> rsmith wrote:
> > Did you skip this one intentionally?
> Yes. `size_type` is a typedef for `allocator_traits<Allocator>::size_type`, This causes the `basic_string(CharT*, Allocator const&)` to always be chosen instead, resulting in a incorrect allocator type.
I don't think it will always be chosen instead; if the argument is of type `size_t`, the `(const CharT*, size_type)` overload should be chosen.
https://reviews.llvm.org/D29863
More information about the cfe-commits
mailing list