diff options
| author | Marshall Clow <mclow.lists@gmail.com> | 2014-07-17 15:32:20 +0000 |
|---|---|---|
| committer | Marshall Clow <mclow.lists@gmail.com> | 2014-07-17 15:32:20 +0000 |
| commit | 3dd88468404bf9117ade3dfc738cb728a6f958d3 (patch) | |
| tree | daf45fff893a31938ea402da3d27021df503e3ad /libcxx/test/strings | |
| parent | 18cfe7d634935c08fc3647d61a1402b69500d6af (diff) | |
| download | bcm5719-llvm-3dd88468404bf9117ade3dfc738cb728a6f958d3.tar.gz bcm5719-llvm-3dd88468404bf9117ade3dfc738cb728a6f958d3.zip | |
Fix bug #20335 - memory leak when move-constructing a string with unequal allocator. Thanks to Thomas Koeppe for the report
llvm-svn: 213269
Diffstat (limited to 'libcxx/test/strings')
| -rw-r--r-- | libcxx/test/strings/basic.string/string.cons/move_alloc.pass.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libcxx/test/strings/basic.string/string.cons/move_alloc.pass.cpp b/libcxx/test/strings/basic.string/string.cons/move_alloc.pass.cpp index 4e8b038ee84..1f9631449ee 100644 --- a/libcxx/test/strings/basic.string/string.cons/move_alloc.pass.cpp +++ b/libcxx/test/strings/basic.string/string.cons/move_alloc.pass.cpp @@ -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; |

