111
|
1 // PR debug/59510
|
|
2 // { dg-do compile }
|
|
3 // { dg-options "-O2 -g --param=large-stack-frame-growth=1" }
|
131
|
4 // { dg-additional-options "-Wno-return-type" }
|
111
|
5
|
|
6 template <typename _Iterator>
|
|
7 struct _Iter_base
|
|
8 {
|
|
9 typedef _Iterator iterator_type;
|
|
10 };
|
|
11 template <typename _CharT>
|
|
12 struct basic_ostream;
|
|
13 template <typename _CharT>
|
|
14 struct basic_ostringstream;
|
|
15 template <typename _CharT>
|
|
16 struct ostreambuf_iterator;
|
|
17 typedef basic_ostringstream <char>ostringstream;
|
|
18 template <typename _Iterator> struct _Miter_base : _Iter_base <_Iterator>
|
|
19 {
|
|
20 };
|
|
21 template <typename _Iterator>
|
|
22 typename _Miter_base <_Iterator>::iterator_type __miter_base (_Iterator);
|
|
23 template <typename _CharT>
|
|
24 ostreambuf_iterator <_CharT>
|
|
25 __copy_move_a2 (ostreambuf_iterator <_CharT>);
|
|
26 template <typename _II, typename _OI>
|
|
27 _OI copy (_II __first, _II __last, _OI __result)
|
|
28 {
|
|
29 __copy_move_a2 <false> (__first, __miter_base (__last), __result);
|
|
30 }
|
|
31 struct ios_base {
|
|
32 struct _Words {
|
|
33 int *_M_pword;
|
|
34 long _M_iword;
|
|
35 };
|
|
36 _Words _M_local_word[8];
|
|
37 };
|
|
38 template <typename _CharT>
|
|
39 struct basic_streambuf
|
|
40 {
|
|
41 typedef _CharT char_type;
|
|
42 int sputn (char_type *, int);
|
|
43 };
|
|
44 template <typename _CharT>
|
|
45 struct ostreambuf_iterator
|
|
46 {
|
|
47 typedef basic_streambuf <_CharT> streambuf_type;
|
|
48 typedef basic_ostream <_CharT> ostream_type;
|
|
49 streambuf_type *_M_sbuf;
|
|
50 bool _M_failed;
|
|
51 ostreambuf_iterator (ostream_type __s) : _M_sbuf (__s.rdbuf ()), _M_failed () {}
|
|
52 void _M_put (_CharT * __ws, int __len)
|
|
53 {
|
|
54 if (_M_failed && _M_sbuf->sputn (__ws, __len) != __len) _M_failed = true;
|
|
55 }
|
|
56 };
|
|
57 template <bool, typename _CharT>
|
|
58 void __copy_move_a2 (_CharT * __first,_CharT * __last,ostreambuf_iterator <_CharT> __result)
|
|
59 {
|
|
60 int __num = __last - __first;
|
|
61 __result._M_put (__first, __num);
|
|
62 }
|
|
63 template <typename _CharT>
|
|
64 struct basic_ios : ios_base
|
|
65 {
|
|
66 basic_streambuf <_CharT> *rdbuf ();
|
|
67 };
|
|
68 template <typename _CharT>
|
|
69 struct basic_ostream : public basic_ios <_CharT>
|
|
70 {
|
|
71 };
|
|
72 template <typename _CharT>
|
|
73 struct basic_ostringstream : public basic_ostream <_CharT>
|
|
74 {
|
|
75 };
|
|
76 void
|
|
77 test01 () {
|
|
78 char data1[] = "foo";
|
|
79 char *beg1 = data1;
|
|
80 ostringstream oss1;
|
|
81 ostreambuf_iterator <char> out1 (oss1);
|
|
82 out1 = copy (beg1, beg1, out1);
|
|
83 }
|