1 // Origin: PR c++/42797
2 // { dg-do compile { target c++11 } }
3 // { dg-options "-g -O2" }
5 template<typename _Tp, _Tp __v> struct integral_constant {
6 static const _Tp value = __v;
9 template<typename _Tp> _Tp declval();
11 template<typename _Tp, typename... _Args>
12 class __is_constructible_helper {
15 template<typename _Tp, typename _Arg>
16 class __is_constructible_helper<_Tp, _Arg> {
18 template<typename _Tp1, typename _Arg1>
19 static decltype(static_cast<_Tp1>(declval<_Arg1>()), char()) __test(int);
21 static const bool __value = sizeof(__test<_Tp, _Arg>(0)) == 1;
24 template<typename _Tp, typename... _Args>
25 struct is_constructible : public integral_constant<bool,__is_constructible_helper<_Tp, _Args...>::__value> { };
27 template<bool, typename _Tp = void>
30 template<typename _Tp>
31 struct enable_if<true, _Tp> {
35 template<class _T1, class _T2> struct pair {
39 template<class _U2, class = typename enable_if<is_constructible<_T2, _U2&&>::value>::type>
40 pair(const _T1& __x, _U2&& __y) : first(__x),
45 template<typename _Tp>
48 new_allocator() throw() { }
49 new_allocator(const new_allocator&) throw() { }
53 template<typename _Tp>
54 class allocator: public __gnu_cxx::new_allocator<_Tp> {
57 template<typename _Tp1>
59 typedef allocator<_Tp1> other;
64 template<typename _Tp, typename _Alloc> struct _Vector_base {
65 typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type;
67 struct _Vector_impl : public _Tp_alloc_type {
76 template<typename _Tp, typename _Alloc = allocator<_Tp> >
77 class vector : protected _Vector_base<_Tp, _Alloc> {
78 typedef _Alloc allocator_type;
81 explicit vector(int, const allocator_type& __a = allocator_type())
87 template <typename _Key, typename _Tp>
89 typedef _Key key_type;
90 typedef _Tp mapped_type;
91 typedef pair<const _Key, _Tp> value_type;
94 void insert(const value_type& __x)
98 mapped_type& operator[](const key_type& __k) {
99 insert(value_type(__k, mapped_type()));
100 static mapped_type a;
107 Foo() {} template<typename Tp> Foo(Tp *p) {} };
109 map <int, vector<Foo>> the_map;
110 the_map[1] = vector<Foo>();