diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/g++.dg/other/crash-8.C | |
download | cbb-gcc-4.6.4-upstream.tar.bz2 cbb-gcc-4.6.4-upstream.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/g++.dg/other/crash-8.C')
-rw-r--r-- | gcc/testsuite/g++.dg/other/crash-8.C | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/other/crash-8.C b/gcc/testsuite/g++.dg/other/crash-8.C new file mode 100644 index 000000000..c260431d5 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/crash-8.C @@ -0,0 +1,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>(); +} + |