]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/23_containers/vector/ext_pointer/types/2.cc
1 // Test for Container using non-standard pointer types.
3 // Copyright (C) 2011-2019 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
21 // { dg-do run { target c++11 } }
23 // This is a copy of vector/types/1.cc with altered allocator.
24 // The operator+()s in this test initially failed the test -
25 // they stress the accurate recognition, by the compiler,
26 // of _Pointer_adapter's own pointer arithmetic functions,
27 // which have to match perfectly on the int type to get
28 // chosen by the compiler when it sees: _Pointer_adapter<T> + int, etc.
31 #include <ext/extptr_allocator.h>
38 X
operator+(T
, std::size_t)
48 std::vector
<N::X
, __gnu_cxx::_ExtPtr_allocator
<N::X
> > v(5);
49 const std::vector
<N::X
, __gnu_cxx::_ExtPtr_allocator
<N::X
> > w(1);
56 v
.insert(v
.begin(), N::X());
57 v
.insert(v
.begin(), 1, N::X());
58 v
.insert(v
.begin(), w
.begin(), w
.end());