mirrored from git://gcc.gnu.org/git/gcc.git
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stl_vector.h (struct _Vector_base<>::_Vector_impl_data): New.
2018-06-27 François Dumont <fdumont@gcc.gnu.org> * include/bits/stl_vector.h (struct _Vector_base<>::_Vector_impl_data): New. (struct _Vector_base<>::_Vector_impl): Inherit from latter. (_Vector_base<>::_Vector_impl::_M_swap_data): Move... (_Vector_base<>::_Vector_impl_data::_M_swap_data): ...here. (_Vector_base<>::_Vector_impl()): Add noexcept qualification. (_Vector_base<>::_Vector_impl(_Vector_impl&&)): New. (_Vector_base<>::_Vector_impl(_Tp_alloc_type&&, _Vector_impl&&)): New. (_Vector_base(const allocator_type&, _Vector_base&&)): New, use latter. (_Vector_base()): Default. (_Vector_base(_Vector_base&&)): Default. (_Vector_base(size_t)) [_GLIBCXX_INLINE_VERSION]: Delete. (_Vector_base(_Tp_alloc_type&&)) [_GLIBCXX_INLINE_VERSION]: Delete. (_Vector_base::_M_create_storage(size_t)): Make protected. (vector()): Default. (vector(vector&&)): Default. (vector(vector&&, const allocator_type&, true_type)): New. (vector(vector&&, const allocator_type&, false_type)): New. (vector(vector&&, const allocator_type&)): Use latters. (vector(_InputIte, _InputIte, const allocator_type&)): Call _M_range_initialize directly. * include/debug/vector (vector(vector&&, const allocator_type&)): Add noexcept qualification. * testsuite/23_containers/vector/allocator/default_init.cc: New. * testsuite/23_containers/vector/cons/noexcept_move_construct.cc: Add static assertions. From-SVN: r262194
- Loading branch information
Showing
5 changed files
with
225 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
libstdc++-v3/testsuite/23_containers/vector/allocator/default_init.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// Copyright (C) 2018 Free Software Foundation, Inc. | ||
// | ||
// This file is part of the GNU ISO C++ Library. This library is free | ||
// software; you can redistribute it and/or modify it under the | ||
// terms of the GNU General Public License as published by the | ||
// Free Software Foundation; either version 3, or (at your option) | ||
// any later version. | ||
|
||
// This library is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License along | ||
// with this library; see the file COPYING3. If not see | ||
// <http://www.gnu.org/licenses/>. | ||
|
||
// { dg-do run { target c++11 } } | ||
// { dg-options "-O0" } | ||
// { dg-xfail-run-if "PR c++/65816" { *-*-* } } | ||
|
||
#include <vector> | ||
#include <testsuite_hooks.h> | ||
#include <testsuite_allocator.h> | ||
|
||
#include <ext/aligned_buffer.h> | ||
|
||
using T = int; | ||
|
||
using __gnu_test::default_init_allocator; | ||
|
||
void test01() | ||
{ | ||
typedef default_init_allocator<T> alloc_type; | ||
typedef std::vector<T, alloc_type> test_type; | ||
|
||
__gnu_cxx::__aligned_buffer<test_type> buf; | ||
__builtin_memset(buf._M_addr(), ~0, sizeof(test_type)); | ||
|
||
test_type *tmp = ::new(buf._M_addr()) test_type; | ||
|
||
VERIFY( tmp->get_allocator().state == 0 ); | ||
|
||
tmp->~test_type(); | ||
} | ||
|
||
void test02() | ||
{ | ||
typedef default_init_allocator<T> alloc_type; | ||
typedef std::vector<T, alloc_type> test_type; | ||
|
||
__gnu_cxx::__aligned_buffer<test_type> buf; | ||
__builtin_memset(buf._M_addr(), ~0, sizeof(test_type)); | ||
|
||
test_type *tmp = ::new(buf._M_addr()) test_type(); | ||
|
||
VERIFY( tmp->get_allocator().state == 0 ); | ||
|
||
tmp->~test_type(); | ||
} | ||
|
||
int main() | ||
{ | ||
test01(); | ||
test02(); | ||
return 0; | ||
} |
Oops, something went wrong.