]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/23_containers/unordered_set/allocator/ext_ptr.cc
1 // Copyright (C) 2013-2021 Free Software Foundation, Inc.
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
18 // This test fails to compile since C++17 (see xfail-if below) so we can only
19 // do a "run" test for C++11 and C++14, and a "compile" test for C++17 and up.
20 // { dg-do run { target { c++11_only || c++14_only } } }
21 // { dg-do compile { target c++17 } }
23 #include <unordered_set>
25 #include <testsuite_hooks.h>
26 #include <testsuite_allocator.h>
29 bool operator==(const T
& l
, const T
& r
) { return l
.i
== r
.i
; }
30 struct H
{ std::size_t operator()(const T
& t
) const noexcept
{ return t
.i
; }
32 struct E
: std::equal_to
<T
> { };
34 using __gnu_test::CustomPointerAlloc
;
36 // { dg-xfail-if "node reinsertion assumes raw pointers" { c++17 } }
37 // TODO when removing this xfail change the test back to "dg-do run".
38 template class std::unordered_set
<T
, H
, E
, CustomPointerAlloc
<T
>>;
42 typedef CustomPointerAlloc
<T
> alloc_type
;
43 typedef std::unordered_set
<T
, H
, E
, alloc_type
> test_type
;
46 VERIFY( ++v
.begin() == v
.end() );