summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/pr47416.C
blob: a11368a50f0a3572e9736a0a534755529f3934fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
// PR c++/47416
// { dg-do compile }
// { dg-options "-std=c++0x" }

namespace std
{
  template < typename _Tp, _Tp __v > struct integral_constant
  {
    static const _Tp value = __v;
  };
  typedef integral_constant < bool, false > false_type;
    template < typename > struct is_array:false_type
  {
  };
    template < typename > struct is_function:false_type
  {
  };
    template < typename _Tp > struct remove_const
  {
    typedef _Tp type;
  };
    template < typename _Tp > struct remove_volatile
  {
    typedef _Tp type;
  };
    template < typename _Tp > struct remove_cv
  {
    typedef typename remove_const < typename remove_volatile <
      _Tp >::type >::type type;
  };
    template < typename > struct remove_reference
  {
  };
    template < typename _Tp > struct remove_reference <_Tp & >
  {
    typedef _Tp type;
  };
    template < typename _Up, bool = is_array < _Up >::value, bool =
    is_function < _Up >::value > struct __decay_selector;
    template < typename _Up > struct __decay_selector <_Up, false, false >
  {
    typedef typename remove_cv < _Up >::type __type;
  };
    template < typename _Tp > class decay
  {
    typedef typename remove_reference < _Tp >::type __remove_type;
  public:typedef typename __decay_selector <
      __remove_type >::__type type;
  };
  template < typename _Tp > struct __strip_reference_wrapper
  {
    typedef _Tp __type;
  };
  template < typename _Tp > struct __decay_and_strip
  {
    typedef typename __strip_reference_wrapper < typename decay <
      _Tp >::type >::__type __type;
  };
  template < typename _Tp > _Tp forward (typename remove_reference <
					 _Tp >::type &)
  {
  }
  template < class _T1, class _T2 > struct pair
  {
    _T1 first;
    _T2 second;
    constexpr pair (_T1, _T2 &):first (), second (__b)	// { dg-error "was not declared in this scope" }
    {
    }
  };
  template < class _T1,
    class _T2 > pair < typename __decay_and_strip < _T1 >::__type,
    typename __decay_and_strip < _T2 >::__type > make_pair (_T1 && __x, _T2
							    && __y)
  {
    typedef typename __decay_and_strip < _T1 >::__type __ds_type1;
    typedef typename __decay_and_strip < _T2 >::__type __ds_type2;
    typedef pair < __ds_type1, __ds_type2 > __pair_type;
    __pair_type (forward < _T1 > (__x), std::forward < _T2 > (__y));
  }
}

typedef long size_t;
namespace std
{
  template < typename > class allocator;
  template < class > struct char_traits;
    template < typename _CharT, typename = char_traits < _CharT >, typename =
    allocator < _CharT > >class basic_string;
  typedef basic_string < char >string;
}
namespace __gnu_cxx
{
  template < bool > class __pool;
  template < template < bool > class, bool > struct __common_pool
  {
  };
    template < template < bool > class, bool > struct __common_pool_base;
    template < template < bool > class _PoolTp >
    struct __common_pool_base <_PoolTp, true >:__common_pool < _PoolTp, true >
  {
  };
    template < template < bool > class _PoolTp,
    bool _Thread > struct __common_pool_policy:__common_pool_base < _PoolTp,
    _Thread >
  {
    template < typename, template < bool > class _PoolTp1 =
      _PoolTp, bool _Thread1 = _Thread > struct _M_rebind
    {
      typedef __common_pool_policy < _PoolTp1, _Thread1 > other;
    };
  };
    template < typename _Tp > class __mt_alloc_base
  {
  };
template < typename _Tp, typename _Poolp = __common_pool_policy < __pool, true > >class __mt_alloc:public __mt_alloc_base <
    _Tp
    >
  {
  public:size_t size_type;
    typedef _Tp value_type;
    template < typename _Tp1, typename _Poolp1 = _Poolp > struct rebind
    {
      typedef typename _Poolp1::template _M_rebind < _Tp1 >::other pol_type;
      typedef __mt_alloc < _Tp1, pol_type > other;
    };
  };
}

namespace std
{
  template < typename _Tp > class allocator:public __gnu_cxx::__mt_alloc <
    _Tp >
  {
  };
  template < typename, typename > struct unary_function
  {
  };
  template < typename, typename, typename > struct binary_function
  {
  };
  template < typename _Tp > struct equal_to:binary_function < _Tp, _Tp, bool >
  {
  };
}

namespace boost
{
  template < class > struct hash;
    template < class K, class T, class = hash < K >, class =
    std::equal_to < K >, class =
    std::allocator < std::pair < const K, T > >>class unordered_map;
    template < >struct hash <std::string >:std::unary_function < std::string,
    size_t >
  {
  };
  namespace unordered_detail
  {
    template < class Alloc, class T > struct rebind_wrap
    {
      typedef typename Alloc::template rebind < T >::other type;
    };
  }
  namespace unordered_detail
  {
    size_t default_bucket_count;
      template < class, class > struct map_extractor;
    struct ungrouped
    {
    };
      template < class T > class hash_table:T::buckets, T::buffered_functions
    {
    };
      template < class, class, class H, class P, class A, class, class G > struct types
    {
      typedef H hasher;
      typedef P key_equal;
      typedef A value_allocator;
    };
      template < class T > class hash_unique_table:T
    {
    public:typedef typename T::hasher hasher;
      typedef typename T::key_equal key_equal;
      typedef typename T::value_allocator value_allocator;
      typedef typename T::table table;
        hash_unique_table (size_t n, hasher, key_equal,
			   value_allocator & a):table (n, a)	// { dg-error "is not a direct base" }
      {
      }
    };
    template < class K, class H, class P, class A > struct map:types < K,
      typename A::value_type, H, P, A, map_extractor < K,
      typename A::value_type >, ungrouped >
    {
      typedef hash_unique_table < map < K, H, P, A > >impl;
      typedef hash_table < map < K, H, P, A > >table;
    };
  }
  template < class K, class T, class H, class P, class A > class unordered_map
  {
    typedef std::pair < const K, T > value_type;
    typedef H hasher;
    typedef P key_equal;
    typedef A allocator_type;
    typedef typename unordered_detail::rebind_wrap < allocator_type,
      value_type >::type value_allocator;
    typedef boost::unordered_detail::map < K, H, P, value_allocator > types;
    typedef typename types::impl table;
    typedef size_t size_type;
  private:table table_;
  public: unordered_map (size_type n = boost::unordered_detail::default_bucket_count,
			 hasher hf = hasher (), key_equal eql = key_equal (),
			 allocator_type a = allocator_type ()):table_ (n, hf, eql, a)	// { dg-message "instantiated" }
    {
    }
  };
};

void
foo (const int &a)
{
  typedef boost::unordered_map < std::string, int >Name2Port;
  Name2Port b;			// { dg-message "instantiated" }
  std::make_pair (a, b);
}