1 // { dg-do run { target c++11 } }
2 // { dg-options "-g -O0" }
3 // { dg-skip-if "" { *-*-* } { "-D_GLIBCXX_PROFILE" } }
5 // Copyright (C) 2011-2017 Free Software Foundation, Inc.
7 // This file is part of the GNU ISO C++ Library. This library is free
8 // software; you can redistribute it and/or modify it under the
9 // terms of the GNU General Public License as published by the
10 // Free Software Foundation; either version 3, or (at your option)
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License along
19 // with this library; see the file COPYING3. If not see
20 // <http://www.gnu.org/licenses/>.
22 #include <forward_list>
23 #include <unordered_map>
24 #include <unordered_set>
29 typedef std::tuple
<int, int> ExTuple
;
33 placeholder(const T
&s
)
38 template<class T
, class S
>
40 placeholder(const std::pair
<T
,S
> &s
)
47 use(const T
&container
)
49 for (typename
T::const_iterator i
= container
.begin();
61 std::unique_ptr
<datum
> global
;
66 std::forward_list
<int> efl
;
67 // { dg-final { note-test efl "empty std::forward_list" } }
69 std::forward_list
<int> &refl
= efl
;
70 // { dg-final { note-test refl "empty std::forward_list" } }
72 std::forward_list
<int> fl
;
75 // { dg-final { note-test fl {std::forward_list = {[0] = 1, [1] = 2}} } }
77 std::forward_list
<int> &rfl
= fl
;
78 // { dg-final { note-test rfl {std::forward_list = {[0] = 1, [1] = 2}} } }
80 std::unordered_map
<int, std::string
> eum
;
81 // { dg-final { note-test eum "std::unordered_map with 0 elements" } }
82 std::unordered_map
<int, std::string
> &reum
= eum
;
83 // { dg-final { note-test reum "std::unordered_map with 0 elements" } }
85 std::unordered_multimap
<int, std::string
> eumm
;
86 // { dg-final { note-test eumm "std::unordered_multimap with 0 elements" } }
87 std::unordered_multimap
<int, std::string
> &reumm
= eumm
;
88 // { dg-final { note-test reumm "std::unordered_multimap with 0 elements" } }
90 std::unordered_set
<int> eus
;
91 // { dg-final { note-test eus "std::unordered_set with 0 elements" } }
92 std::unordered_set
<int> &reus
= eus
;
93 // { dg-final { note-test reus "std::unordered_set with 0 elements" } }
95 std::unordered_multiset
<int> eums
;
96 // { dg-final { note-test eums "std::unordered_multiset with 0 elements" } }
97 std::unordered_multiset
<int> &reums
= eums
;
98 // { dg-final { note-test reums "std::unordered_multiset with 0 elements" } }
100 std::unordered_map
<int, std::string
> uom
;
103 // { dg-final { note-test uom {std::unordered_map with 2 elements = {[3] = "seven", [5] = "three"}} } }
105 std::unordered_map
<int, std::string
> &ruom
= uom
;
106 // { dg-final { note-test ruom {std::unordered_map with 2 elements = {[3] = "seven", [5] = "three"}} } }
108 std::unordered_multimap
<int, std::string
> uomm
;
109 uomm
.insert(std::pair
<int, std::string
> (5, "three"));
110 uomm
.insert(std::pair
<int, std::string
> (5, "seven"));
111 // { dg-final { note-test uomm {std::unordered_multimap with 2 elements = {[5] = "seven", [5] = "three"}} } }
112 std::unordered_multimap
<int, std::string
> &ruomm
= uomm
;
113 // { dg-final { note-test ruomm {std::unordered_multimap with 2 elements = {[5] = "seven", [5] = "three"}} } }
115 std::unordered_set
<int> uos
;
117 // { dg-final { note-test uos {std::unordered_set with 1 element = {[0] = 5}} } }
118 std::unordered_set
<int> &ruos
= uos
;
119 // { dg-final { note-test ruos {std::unordered_set with 1 element = {[0] = 5}} } }
121 std::unordered_multiset
<int> uoms
;
123 // { dg-final { note-test uoms {std::unordered_multiset with 1 element = {[0] = 5}} } }
124 std::unordered_multiset
<int> &ruoms
= uoms
;
125 // { dg-final { note-test ruoms {std::unordered_multiset with 1 element = {[0] = 5}} } }
127 std::unique_ptr
<datum
> uptr (new datum
);
130 // { dg-final { regexp-test uptr {std::unique_ptr.datum. containing 0x.*} } }
131 std::unique_ptr
<datum
> &ruptr
= uptr
;
132 // { dg-final { regexp-test ruptr {std::unique_ptr.datum. containing 0x.*} } }
135 // { dg-final { note-test tpl {std::tuple containing = {[1] = 6, [2] = 7}} } }
137 // { dg-final { note-test rtpl {std::tuple containing = {[1] = 6, [2] = 7}} } }
138 placeholder(""); // Mark SPOT
152 // { dg-final { gdb-test SPOT } }