1 // Origin: PR c++/42797
2 // { dg-options "-g -O2 -std=c++0x" }
4 template<typename _Tp, _Tp __v> struct integral_constant {
5 static const _Tp value = __v;
8 template<typename _Tp> _Tp declval();
10 template<typename _Tp, typename... _Args>
11 class __is_constructible_helper {
14 template<typename _Tp, typename _Arg>
15 class __is_constructible_helper<_Tp, _Arg> {
17 template<typename _Tp1, typename _Arg1>
18 static decltype(static_cast<_Tp1>(declval<_Arg1>()), char()) __test(int);
20 static const bool __value = sizeof(__test<_Tp, _Arg>(0)) == 1;
23 template<typename _Tp, typename... _Args>
24 struct is_constructible : public integral_constant<bool,__is_constructible_helper<_Tp, _Args...>::__value> { };
26 template<bool, typename _Tp = void>
29 template<typename _Tp>
30 struct enable_if<true, _Tp> {
34 template<class _T1, class _T2> struct pair {
38 template<class _U2, class = typename enable_if<is_constructible<_T2, _U2&&>::value>::type>
39 pair(const _T1& __x, _U2&& __y) : first(__x),
44 template<typename _Tp>
47 new_allocator() throw() { }
48 new_allocator(const new_allocator&) throw() { }
52 template<typename _Tp>
53 class allocator: public __gnu_cxx::new_allocator<_Tp> {
56 template<typename _Tp1>
58 typedef allocator<_Tp1> other;
63 template<typename _Tp, typename _Alloc> struct _Vector_base {
64 typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type;
66 struct _Vector_impl : public _Tp_alloc_type {
75 template<typename _Tp, typename _Alloc = allocator<_Tp> >
76 class vector : protected _Vector_base<_Tp, _Alloc> {
77 typedef _Alloc allocator_type;
80 explicit vector(int, const allocator_type& __a = allocator_type())
86 template <typename _Key, typename _Tp>
88 typedef _Key key_type;
89 typedef _Tp mapped_type;
90 typedef pair<const _Key, _Tp> value_type;
93 void insert(const value_type& __x)
97 mapped_type& operator[](const key_type& __k) {
98 insert(value_type(__k, mapped_type()));
104 Foo() {} template<typename Tp> Foo(Tp *p) {} };
106 map <int, vector<Foo>> the_map;
107 the_map[1] = vector<Foo>();