Debian Codegraph @

gcc/testsuite/g++.dg/torture/pr57107.C

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