Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/torture/pr57107.C @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children | 84e7813d76e9 |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 // { dg-do compile } | |
2 | |
3 typedef long unsigned int size_t; | |
4 namespace std { | |
5 } | |
6 namespace std __attribute__ ((__visibility__ ("default"))) { | |
7 template<class _Sp, class _Tp> struct __traitor { | |
8 enum { | |
9 __value = bool(_Sp::__value) || bool(_Tp::__value) }; | |
10 }; | |
11 template<typename _Tp> struct __is_integer { | |
12 enum { | |
13 __value = 0 }; | |
14 }; | |
15 template<typename _Tp> struct __is_floating { | |
16 enum { | |
17 __value = 0 }; | |
18 }; | |
19 template<typename _Tp> struct __is_pointer { | |
20 enum { | |
21 __value = 0 }; | |
22 }; | |
23 template<typename _Tp> struct __is_normal_iterator { | |
24 enum { | |
25 __value = 0 }; | |
26 }; | |
27 template<typename _Tp> struct __is_arithmetic : public __traitor<__is_integer<_Tp>, __is_floating<_Tp> > { | |
28 }; | |
29 template<typename _Tp> struct __is_scalar : public __traitor<__is_arithmetic<_Tp>, __is_pointer<_Tp> > { | |
30 }; | |
31 } | |
32 namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { | |
33 template<bool, typename> struct __enable_if { | |
34 }; | |
35 template<typename _Tp> struct __enable_if<true, _Tp> { | |
36 typedef _Tp __type; | |
37 }; | |
38 } | |
39 namespace std __attribute__ ((__visibility__ ("default"))) { | |
40 template<typename _Iterator> struct iterator_traits { | |
41 }; | |
42 template<typename _Tp> struct iterator_traits<_Tp*> { | |
43 typedef _Tp value_type; | |
44 }; | |
45 template<typename _Iterator, bool _HasBase> struct _Iter_base { | |
46 typedef _Iterator iterator_type; | |
47 }; | |
48 } | |
49 namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { | |
50 } | |
51 namespace std __attribute__ ((__visibility__ ("default"))) { | |
52 template<typename _Iterator> struct _Niter_base : _Iter_base<_Iterator, __is_normal_iterator<_Iterator>::__value> { | |
53 }; | |
54 template<typename _Iterator> inline typename _Niter_base<_Iterator>::iterator_type __niter_base(_Iterator __it) { | |
55 } | |
56 template<typename _OutputIterator, typename _Size, typename _Tp> inline typename __gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, _OutputIterator>::__type __fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value) { | |
57 for (__decltype(__n + 0) __niter = __n; | |
58 __niter > 0; | |
59 --__niter, ++__first) *__first = __value; | |
60 } | |
61 template<typename _OI, typename _Size, typename _Tp> inline _OI fill_n(_OI __first, _Size __n, const _Tp& __value) { | |
62 return _OI(std::__fill_n_a(std::__niter_base(__first), __n, __value)); | |
63 } | |
64 } | |
65 namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { | |
66 template<typename _Tp> class new_allocator { | |
67 public: | |
68 typedef size_t size_type; | |
69 typedef _Tp* pointer; | |
70 ~new_allocator() throw() { | |
71 } | |
72 pointer allocate(size_type __n, const void* = 0) { | |
73 return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp))); | |
74 } | |
75 }; | |
76 } | |
77 namespace std __attribute__ ((__visibility__ ("default"))) { | |
78 template<typename _Tp> class allocator: public __gnu_cxx::new_allocator<_Tp> { | |
79 public: | |
80 template<typename _Tp1> struct rebind { | |
81 typedef allocator<_Tp1> other; | |
82 }; | |
83 }; | |
84 } | |
85 namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { | |
86 template<typename _Alloc> struct __alloc_traits { | |
87 typedef typename _Alloc::pointer pointer; | |
88 template<typename _Tp> struct rebind { | |
89 typedef typename _Alloc::template rebind<_Tp>::other other; | |
90 }; | |
91 }; | |
92 } | |
93 class QString { | |
94 public: | |
95 bool isEmpty() const; | |
96 }; | |
97 class QObject { | |
98 }; | |
99 namespace std __attribute__ ((__visibility__ ("default"))) { | |
100 template<bool _TrivialValueType> struct __uninitialized_fill_n { | |
101 template<typename _ForwardIterator, typename _Size, typename _Tp> static void __uninit_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) { | |
102 std::fill_n(__first, __n, __x); | |
103 } | |
104 }; | |
105 template<typename _ForwardIterator, typename _Size, typename _Tp> inline void uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) { | |
106 typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; | |
107 std::__uninitialized_fill_n<__is_trivial(_ValueType)>:: __uninit_fill_n(__first, __n, __x); | |
108 } | |
109 template<typename _ForwardIterator, typename _Size, typename _Tp, typename _Tp2> inline void __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n, const _Tp& __x, allocator<_Tp2>&) { | |
110 std::uninitialized_fill_n(__first, __n, __x); | |
111 } | |
112 template<typename _Tp, typename _Alloc> struct _Vector_base { | |
113 typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template rebind<_Tp>::other _Tp_alloc_type; | |
114 typedef typename __gnu_cxx::__alloc_traits<_Tp_alloc_type>::pointer pointer; | |
115 struct _Vector_impl : public _Tp_alloc_type { | |
116 pointer _M_start; | |
117 pointer _M_finish; | |
118 pointer _M_end_of_storage; | |
119 _Vector_impl(_Tp_alloc_type const& __a) : _Tp_alloc_type(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0) { | |
120 } | |
121 }; | |
122 typedef _Alloc allocator_type; | |
123 _Tp_alloc_type& _M_get_Tp_allocator() { | |
124 } | |
125 _Vector_base(size_t __n, const allocator_type& __a) : _M_impl(__a) { | |
126 _M_create_storage(__n); | |
127 } | |
128 _Vector_impl _M_impl; | |
129 pointer _M_allocate(size_t __n) { | |
130 return __n != 0 ? _M_impl.allocate(__n) : 0; | |
131 } | |
132 void _M_create_storage(size_t __n) { | |
133 this->_M_impl._M_start = this->_M_allocate(__n); | |
134 this->_M_impl._M_finish = this->_M_impl._M_start; | |
135 } | |
136 }; | |
137 template<typename _Tp, typename _Alloc = std::allocator<_Tp> > class vector : protected _Vector_base<_Tp, _Alloc> { | |
138 typedef _Vector_base<_Tp, _Alloc> _Base; | |
139 typedef _Tp value_type; | |
140 typedef size_t size_type; | |
141 typedef _Alloc allocator_type; | |
142 using _Base::_M_get_Tp_allocator; | |
143 public: | |
144 explicit vector(size_type __n, const value_type& __value = value_type(), const allocator_type& __a = allocator_type()) : _Base(__n, __a) { | |
145 _M_fill_initialize(__n, __value); | |
146 } | |
147 void _M_fill_initialize(size_type __n, const value_type& __value) { | |
148 std::__uninitialized_fill_n_a(this->_M_impl._M_start, __n, __value, _M_get_Tp_allocator()); | |
149 } | |
150 }; | |
151 }; | |
152 class QPaintDevice { | |
153 public: | |
154 int width() const { | |
155 } | |
156 int height() const { | |
157 } | |
158 }; | |
159 class QImage : public QPaintDevice { | |
160 }; | |
161 extern "C" { | |
162 struct __jmp_buf_tag { | |
163 }; | |
164 typedef struct __jmp_buf_tag jmp_buf[1]; | |
165 extern int _setjmp (struct __jmp_buf_tag __env[1]) throw (); | |
166 extern void longjmp (struct __jmp_buf_tag __env[1], int __val) throw () __attribute__ ((__noreturn__)); | |
167 } | |
168 typedef unsigned int png_uint_32; | |
169 typedef void * png_voidp; | |
170 typedef const char * png_const_charp; | |
171 extern "C" { | |
172 typedef struct png_struct_def png_struct; | |
173 typedef png_struct * png_structp; | |
174 typedef void ( *png_error_ptr) (png_structp, png_const_charp); | |
175 typedef void ( *png_longjmp_ptr) (jmp_buf, int); | |
176 extern __attribute__((__malloc__)) png_structp ( png_create_write_struct) (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn) ; | |
177 extern jmp_buf* ( png_set_longjmp_fn) (png_structp png_ptr, png_longjmp_ptr longjmp_fn, size_t jmp_buf_size) ; | |
178 } | |
179 class PngWriter : public QObject { | |
180 const QImage *m_out_qimage; | |
181 QString m_fname; | |
182 bool writeQImageToPng(); | |
183 }; | |
184 bool PngWriter::writeQImageToPng() { | |
185 png_uint_32 width = m_out_qimage->width(); | |
186 png_uint_32 height = m_out_qimage->height(); | |
187 if ( !m_fname.isEmpty() ) { | |
188 std::vector<char> t(width * height * 4 + (width * height * 4) * 0.1); | |
189 } | |
190 png_structp png_ptr = png_create_write_struct ("1.5.13", __null, __null, __null); | |
191 if (_setjmp ((*png_set_longjmp_fn((png_ptr), longjmp, sizeof (jmp_buf))))) { | |
192 } | |
193 } |