Fix bug #20335 - memory leak when move-constructing a string with unequal allocator. Thanks to Thomas Koeppe for the report
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@213269 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -45,6 +45,16 @@ int main()
|
||||
test(S("1"), A(5));
|
||||
test(S("1234567890123456789012345678901234567890123456789012345678901234567890"), A(7));
|
||||
}
|
||||
|
||||
int alloc_count = test_alloc_base::alloc_count;
|
||||
{
|
||||
typedef test_allocator<char> A;
|
||||
typedef std::basic_string<char, std::char_traits<char>, A> S;
|
||||
S s1 ( "Twas brillig, and the slivy toves did gyre and gymbal in the wabe" );
|
||||
S s2 (std::move(s1), A(1));
|
||||
}
|
||||
assert ( test_alloc_base::alloc_count == alloc_count );
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
{
|
||||
typedef min_allocator<char> A;
|
||||
|
Reference in New Issue
Block a user