summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/other/crash-8.C
blob: c260431d5ec587c1827013cbad67cc9540b9bf22 (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
// Origin: PR c++/42797
// { dg-options "-g -O2 -std=c++0x" }

template<typename _Tp, _Tp __v>     struct integral_constant     {
    static const _Tp value = __v;
};

template<typename _Tp>     _Tp declval();

template<typename _Tp, typename... _Args>
class __is_constructible_helper  {
};

template<typename _Tp, typename _Arg>
class __is_constructible_helper<_Tp, _Arg>  {

    template<typename _Tp1, typename _Arg1>
    static decltype(static_cast<_Tp1>(declval<_Arg1>()), char())  __test(int);
public:
    static const bool __value = sizeof(__test<_Tp, _Arg>(0)) == 1;
};

template<typename _Tp, typename... _Args>
struct is_constructible     : public integral_constant<bool,__is_constructible_helper<_Tp, _Args...>::__value>     { };

template<bool, typename _Tp = void>
struct enable_if  { };

template<typename _Tp>
struct enable_if<true, _Tp>     {
    typedef _Tp type;
};

template<class _T1, class _T2>     struct pair     {
    _T1 first;
    _T2 second;

    template<class _U2, class = typename  enable_if<is_constructible<_T2, _U2&&>::value>::type>
    pair(const _T1& __x, _U2&& __y)  : first(__x),
                                       second(__y) { }
};

namespace __gnu_cxx {
template<typename _Tp>
class new_allocator     {
public:
    new_allocator() throw() { }
    new_allocator(const new_allocator&) throw() { }
};
}

template<typename _Tp>
class allocator: public __gnu_cxx::new_allocator<_Tp>     {
public:

    template<typename _Tp1>
    struct rebind  {
        typedef allocator<_Tp1> other;
    };
};


template<typename _Tp, typename _Alloc>     struct _Vector_base     {
    typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type;

    struct _Vector_impl       : public _Tp_alloc_type   {
        _Vector_impl()
        { }
    };
public:

    _Vector_impl _M_impl;
};

template<typename _Tp, typename _Alloc = allocator<_Tp> >
class vector : protected _Vector_base<_Tp, _Alloc> {
    typedef _Alloc allocator_type;
public:
    vector()       { }
    explicit       vector(int, const allocator_type& __a = allocator_type())
    {
    }
};


template <typename _Key, typename _Tp>
class map {
    typedef _Key key_type;
    typedef _Tp mapped_type;
    typedef pair<const _Key, _Tp> value_type;
public:

    void insert(const value_type& __x)
    {
    }

    mapped_type&       operator[](const key_type& __k)       {
        insert(value_type(__k, mapped_type()));
    }

};

struct Foo {
    Foo() {}      template<typename Tp>     Foo(Tp *p) {} };
void foo() {
    map <int, vector<Foo>> the_map;
    the_map[1] = vector<Foo>();
}