Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/cpp0x/pr47416.C @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children | 84e7813d76e9 |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 // PR c++/47416 | |
2 // { dg-do compile { target c++11 } } | |
3 | |
4 namespace std | |
5 { | |
6 template < typename _Tp, _Tp __v > struct integral_constant | |
7 { | |
8 static const _Tp value = __v; | |
9 }; | |
10 typedef integral_constant < bool, false > false_type; | |
11 template < typename > struct is_array:false_type | |
12 { | |
13 }; | |
14 template < typename > struct is_function:false_type | |
15 { | |
16 }; | |
17 template < typename _Tp > struct remove_const | |
18 { | |
19 typedef _Tp type; | |
20 }; | |
21 template < typename _Tp > struct remove_volatile | |
22 { | |
23 typedef _Tp type; | |
24 }; | |
25 template < typename _Tp > struct remove_cv | |
26 { | |
27 typedef typename remove_const < typename remove_volatile < | |
28 _Tp >::type >::type type; | |
29 }; | |
30 template < typename > struct remove_reference | |
31 { | |
32 }; | |
33 template < typename _Tp > struct remove_reference <_Tp & > | |
34 { | |
35 typedef _Tp type; | |
36 }; | |
37 template < typename _Up, bool = is_array < _Up >::value, bool = | |
38 is_function < _Up >::value > struct __decay_selector; | |
39 template < typename _Up > struct __decay_selector <_Up, false, false > | |
40 { | |
41 typedef typename remove_cv < _Up >::type __type; | |
42 }; | |
43 template < typename _Tp > class decay | |
44 { | |
45 typedef typename remove_reference < _Tp >::type __remove_type; | |
46 public:typedef typename __decay_selector < | |
47 __remove_type >::__type type; | |
48 }; | |
49 template < typename _Tp > struct __strip_reference_wrapper | |
50 { | |
51 typedef _Tp __type; | |
52 }; | |
53 template < typename _Tp > struct __decay_and_strip | |
54 { | |
55 typedef typename __strip_reference_wrapper < typename decay < | |
56 _Tp >::type >::__type __type; | |
57 }; | |
58 template < typename _Tp > _Tp forward (typename remove_reference < | |
59 _Tp >::type &) | |
60 { | |
61 } | |
62 template < class _T1, class _T2 > struct pair | |
63 { | |
64 _T1 first; | |
65 _T2 second; | |
66 constexpr pair (_T1, _T2 &):first (), second (__b) // { dg-error "was not declared in this scope" } | |
67 { | |
68 } | |
69 }; | |
70 template < class _T1, | |
71 class _T2 > pair < typename __decay_and_strip < _T1 >::__type, | |
72 typename __decay_and_strip < _T2 >::__type > make_pair (_T1 && __x, _T2 | |
73 && __y) | |
74 { | |
75 typedef typename __decay_and_strip < _T1 >::__type __ds_type1; | |
76 typedef typename __decay_and_strip < _T2 >::__type __ds_type2; | |
77 typedef pair < __ds_type1, __ds_type2 > __pair_type; | |
78 __pair_type (forward < _T1 > (__x), std::forward < _T2 > (__y)); | |
79 } | |
80 } | |
81 | |
82 typedef long size_t; | |
83 namespace std | |
84 { | |
85 template < typename > class allocator; | |
86 template < class > struct char_traits; | |
87 template < typename _CharT, typename = char_traits < _CharT >, typename = | |
88 allocator < _CharT > >class basic_string; | |
89 typedef basic_string < char >string; | |
90 } | |
91 namespace __gnu_cxx | |
92 { | |
93 template < bool > class __pool; | |
94 template < template < bool > class, bool > struct __common_pool | |
95 { | |
96 }; | |
97 template < template < bool > class, bool > struct __common_pool_base; | |
98 template < template < bool > class _PoolTp > | |
99 struct __common_pool_base <_PoolTp, true >:__common_pool < _PoolTp, true > | |
100 { | |
101 }; | |
102 template < template < bool > class _PoolTp, | |
103 bool _Thread > struct __common_pool_policy:__common_pool_base < _PoolTp, | |
104 _Thread > | |
105 { | |
106 template < typename, template < bool > class _PoolTp1 = | |
107 _PoolTp, bool _Thread1 = _Thread > struct _M_rebind | |
108 { | |
109 typedef __common_pool_policy < _PoolTp1, _Thread1 > other; | |
110 }; | |
111 }; | |
112 template < typename _Tp > class __mt_alloc_base | |
113 { | |
114 }; | |
115 template < typename _Tp, typename _Poolp = __common_pool_policy < __pool, true > >class __mt_alloc:public __mt_alloc_base < | |
116 _Tp | |
117 > | |
118 { | |
119 public:size_t size_type; | |
120 typedef _Tp value_type; | |
121 template < typename _Tp1, typename _Poolp1 = _Poolp > struct rebind | |
122 { | |
123 typedef typename _Poolp1::template _M_rebind < _Tp1 >::other pol_type; | |
124 typedef __mt_alloc < _Tp1, pol_type > other; | |
125 }; | |
126 }; | |
127 } | |
128 | |
129 namespace std | |
130 { | |
131 template < typename _Tp > class allocator:public __gnu_cxx::__mt_alloc < | |
132 _Tp > | |
133 { | |
134 }; | |
135 template < typename, typename > struct unary_function | |
136 { | |
137 }; | |
138 template < typename, typename, typename > struct binary_function | |
139 { | |
140 }; | |
141 template < typename _Tp > struct equal_to:binary_function < _Tp, _Tp, bool > | |
142 { | |
143 }; | |
144 } | |
145 | |
146 namespace boost | |
147 { | |
148 template < class > struct hash; | |
149 template < class K, class T, class = hash < K >, class = | |
150 std::equal_to < K >, class = | |
151 std::allocator < std::pair < const K, T > >>class unordered_map; | |
152 template < >struct hash <std::string >:std::unary_function < std::string, | |
153 size_t > | |
154 { | |
155 }; | |
156 namespace unordered_detail | |
157 { | |
158 template < class Alloc, class T > struct rebind_wrap | |
159 { | |
160 typedef typename Alloc::template rebind < T >::other type; | |
161 }; | |
162 } | |
163 namespace unordered_detail | |
164 { | |
165 size_t default_bucket_count; | |
166 template < class, class > struct map_extractor; | |
167 struct ungrouped | |
168 { | |
169 }; | |
170 template < class T > class hash_table:T::buckets, T::buffered_functions | |
171 { | |
172 }; | |
173 template < class, class, class H, class P, class A, class, class G > struct types | |
174 { | |
175 typedef H hasher; | |
176 typedef P key_equal; | |
177 typedef A value_allocator; | |
178 }; | |
179 template < class T > class hash_unique_table:T | |
180 { | |
181 public:typedef typename T::hasher hasher; | |
182 typedef typename T::key_equal key_equal; | |
183 typedef typename T::value_allocator value_allocator; | |
184 typedef typename T::table table; | |
185 hash_unique_table (size_t n, hasher, key_equal, | |
186 value_allocator & a):table (n, a) // { dg-error "is not a direct base" } | |
187 { | |
188 } | |
189 }; | |
190 template < class K, class H, class P, class A > struct map:types < K, | |
191 typename A::value_type, H, P, A, map_extractor < K, | |
192 typename A::value_type >, ungrouped > | |
193 { | |
194 typedef hash_unique_table < map < K, H, P, A > >impl; | |
195 typedef hash_table < map < K, H, P, A > >table; | |
196 }; | |
197 } | |
198 template < class K, class T, class H, class P, class A > class unordered_map | |
199 { | |
200 typedef std::pair < const K, T > value_type; | |
201 typedef H hasher; | |
202 typedef P key_equal; | |
203 typedef A allocator_type; | |
204 typedef typename unordered_detail::rebind_wrap < allocator_type, | |
205 value_type >::type value_allocator; | |
206 typedef boost::unordered_detail::map < K, H, P, value_allocator > types; | |
207 typedef typename types::impl table; | |
208 typedef size_t size_type; | |
209 private:table table_; | |
210 public: unordered_map (size_type n = boost::unordered_detail::default_bucket_count, | |
211 hasher hf = hasher (), key_equal eql = key_equal (), | |
212 allocator_type a = allocator_type ()):table_ (n, hf, eql, a) // { dg-message "required" } | |
213 { | |
214 } | |
215 }; | |
216 } | |
217 | |
218 void | |
219 foo (const int &a) | |
220 { | |
221 typedef boost::unordered_map < std::string, int >Name2Port; | |
222 Name2Port b; // { dg-message "required" } | |
223 std::make_pair (a, b); | |
224 } |