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