1 // Copyright (C) 2014-2025 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 // { dg-do compile { target c++11 } }
22 using test_type
= std::queue
<int>;
23 using container
= test_type::container_type
;
26 using uses_allocator
= std::uses_allocator
<test_type
, A
>;
28 template<typename
... Args
>
29 using is_constructible
= std::is_constructible
<test_type
, Args
...>;
31 // test with valid allocator
32 using alloc_type
= container::allocator_type
;
34 static_assert( uses_allocator
<alloc_type
>::value
, "valid allocator" );
36 static_assert( is_constructible
<const alloc_type
&>::value
,
37 "queue(const Alloc&)" );
38 static_assert( is_constructible
<const container
&, const alloc_type
&>::value
,
39 "queue(const container_type&, const Alloc&)" );
40 static_assert( is_constructible
<container
&&, const alloc_type
&>::value
,
41 "queue(const container_type&, const Alloc&)" );
42 static_assert( is_constructible
<const test_type
&, const alloc_type
&>::value
,
43 "queue(const queue&, const Alloc&)" );
44 static_assert( is_constructible
<test_type
&&, const alloc_type
&>::value
,
45 "queue(const queue&, const Alloc&)" );
47 // test with invalid allocator
50 static_assert( !uses_allocator
<X
>::value
, "invalid allocator" );
52 static_assert( !is_constructible
<const X
&>::value
,
53 "queue(const NonAlloc&)" );
54 static_assert( !is_constructible
<const container
&, const X
&>::value
,
55 "queue(const container_type&, const NonAlloc&)" );
56 static_assert( !is_constructible
<container
&&, const X
&>::value
,
57 "queue(const container_type&, const NonAlloc&)" );
58 static_assert( !is_constructible
<const test_type
&, const X
&>::value
,
59 "queue(const queue&, const NonAlloc&)" );
60 static_assert( !is_constructible
<test_type
&&, const X
&>::value
,
61 "queue(const queue&, const NonAlloc&)" );