1 // { dg-do run { target c++11 } }
2 // { dg-options "-g -O0" }
4 // Copyright (C) 2011-2016 Free Software Foundation, Inc.
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING3. If not see
19 // <http://www.gnu.org/licenses/>.
21 #include <forward_list>
22 #include <unordered_map>
23 #include <unordered_set>
28 typedef std::tuple
<int, int> ExTuple
;
32 placeholder(const T
&s
)
37 template<class T
, class S
>
39 placeholder(const std::pair
<T
,S
> &s
)
46 use(const T
&container
)
48 for (typename
T::const_iterator i
= container
.begin();
60 std::unique_ptr
<datum
> global
;
65 std::forward_list
<int> efl
;
66 // { dg-final { note-test efl "empty std::forward_list" } }
68 std::forward_list
<int> &refl
= efl
;
69 // { dg-final { note-test refl "empty std::forward_list" } }
71 std::forward_list
<int> fl
;
74 // { dg-final { note-test fl {std::forward_list = {[0] = 1, [1] = 2}} } }
76 std::forward_list
<int> &rfl
= fl
;
77 // { dg-final { note-test rfl {std::forward_list = {[0] = 1, [1] = 2}} } }
79 std::unordered_map
<int, std::string
> eum
;
80 // { dg-final { note-test eum "std::unordered_map with 0 elements" } }
81 std::unordered_map
<int, std::string
> &reum
= eum
;
82 // { dg-final { note-test reum "std::unordered_map with 0 elements" } }
84 std::unordered_multimap
<int, std::string
> eumm
;
85 // { dg-final { note-test eumm "std::unordered_multimap with 0 elements" } }
86 std::unordered_multimap
<int, std::string
> &reumm
= eumm
;
87 // { dg-final { note-test reumm "std::unordered_multimap with 0 elements" } }
89 std::unordered_set
<int> eus
;
90 // { dg-final { note-test eus "std::unordered_set with 0 elements" } }
91 std::unordered_set
<int> &reus
= eus
;
92 // { dg-final { note-test reus "std::unordered_set with 0 elements" } }
94 std::unordered_multiset
<int> eums
;
95 // { dg-final { note-test eums "std::unordered_multiset with 0 elements" } }
96 std::unordered_multiset
<int> &reums
= eums
;
97 // { dg-final { note-test reums "std::unordered_multiset with 0 elements" } }
99 std::unordered_map
<int, std::string
> uom
;
102 // { dg-final { note-test uom {std::unordered_map with 2 elements = {[3] = "seven", [5] = "three"}} } }
104 std::unordered_map
<int, std::string
> &ruom
= uom
;
105 // { dg-final { note-test ruom {std::unordered_map with 2 elements = {[3] = "seven", [5] = "three"}} } }
107 std::unordered_multimap
<int, std::string
> uomm
;
108 uomm
.insert(std::pair
<int, std::string
> (5, "three"));
109 uomm
.insert(std::pair
<int, std::string
> (5, "seven"));
110 // { dg-final { note-test uomm {std::unordered_multimap with 2 elements = {[5] = "seven", [5] = "three"}} } }
111 std::unordered_multimap
<int, std::string
> &ruomm
= uomm
;
112 // { dg-final { note-test ruomm {std::unordered_multimap with 2 elements = {[5] = "seven", [5] = "three"}} } }
114 std::unordered_set
<int> uos
;
116 // { dg-final { note-test uos {std::unordered_set with 1 element = {[0] = 5}} } }
117 std::unordered_set
<int> &ruos
= uos
;
118 // { dg-final { note-test ruos {std::unordered_set with 1 element = {[0] = 5}} } }
120 std::unordered_multiset
<int> uoms
;
122 // { dg-final { note-test uoms {std::unordered_multiset with 1 element = {[0] = 5}} } }
123 std::unordered_multiset
<int> &ruoms
= uoms
;
124 // { dg-final { note-test ruoms {std::unordered_multiset with 1 element = {[0] = 5}} } }
126 std::unique_ptr
<datum
> uptr (new datum
);
129 // { dg-final { regexp-test uptr {std::unique_ptr.datum. containing 0x.*} } }
130 std::unique_ptr
<datum
> &ruptr
= uptr
;
131 // { dg-final { regexp-test ruptr {std::unique_ptr.datum. containing 0x.*} } }
134 // { dg-final { note-test tpl {std::tuple containing = {[1] = 6, [2] = 7}} } }
136 // { dg-final { note-test rtpl {std::tuple containing = {[1] = 6, [2] = 7}} } }
137 placeholder(""); // Mark SPOT
151 // { dg-final { gdb-test SPOT } }