]> gcc.gnu.org Git - gcc.git/blame - gcc/testsuite/g++.dg/lto/pr65475c_0.C
c++: Improve access checking inside templates [PR41437]
[gcc.git] / gcc / testsuite / g++.dg / lto / pr65475c_0.C
CommitLineData
b1905808 1/* { dg-lto-do link } */
b1905808 2/* { dg-extra-ld-options { -O2 -Wno-odr -r -nostdlib } } */
19520957
ML
3/* { dg-lto-options { "-O2 -w -Wno-return-type" } } */
4
b1905808
JH
5namespace std
6{
7template < class > struct char_traits;
8typedef long streamsize;
9template < typename, typename > class basic_streambuf;
10template < typename > class A;
11template < typename, typename > class basic_ostream;
12template < typename _CharT, typename =
13 char_traits < _CharT > >class istreambuf_iterator;
14template < typename _CharT, typename =
15 char_traits < _CharT > >class ostreambuf_iterator;
16template < typename > class ctype;
17template < typename _CharT, typename =
18 istreambuf_iterator < _CharT > >class num_get;
19template < typename _CharT, typename =
20 ostreambuf_iterator < _CharT > >class num_put;
21}
22typedef int _Atomic_word;
23namespace std
24{
25class locale
26{
92bed036 27public:
b1905808 28 class facet;
92bed036 29private:
b1905808
JH
30 class _Impl;
31 _Impl *_M_impl;
32};
33class locale::facet
34{
35 _Atomic_word _M_refcount;
36protected:
37 virtual ~ facet ();
38};
39enum _Ios_Fmtflags
40{ _S_boolalpha = 1, _S_dec, _S_fixed = 1 << 2, _S_hex =
41 1 << 3, _S_internal = 1 << 4, _S_left = 1 << 5, _S_oct =
42 1 << 6, _S_right = 1 << 7, _S_scientific = 1 << 8, _S_showbase =
43 1 << 9, _S_showpoint = 1 << 10, _S_showpos = 1 << 11, _S_skipws =
44 1 << 12, _S_unitbuf = 1 << 13, _S_uppercase = 1 << 14, _S_adjustfield =
45 _S_left | _S_right | _S_internal, _S_basefield =
46 _S_dec | _S_oct | _S_hex, _S_floatfield =
47 _S_scientific | _S_fixed, _S_ios_fmtflags_end = 1 << 16
48};
49enum _Ios_Iostate
50{ _S_goodbit, _S_badbit, _S_eofbit, _S_failbit =
51 1 << 2, _S_ios_iostate_end = 1 << 16
52};
53class ios_base
54{
55 typedef _Ios_Fmtflags fmtflags;
56 typedef _Ios_Iostate iostate;
57 streamsize _M_precision;
58 streamsize _M_width;
59 fmtflags _M_flags;
60 iostate _M_exception;
61 iostate _M_streambuf_state;
62 struct _Callback_list;
63 _Callback_list *_M_callbacks;
64 struct _Words
65 {
66 void *_M_pword;
67 long _M_iword;
68 } _M_word_zero;
69 enum
70 { _S_local_word_size = 8 };
71 _Words _M_local_word[_S_local_word_size];
72 int _M_word_size;
73 _Words *_M_word;
74 locale _M_ios_locale;
92bed036 75protected:
b1905808
JH
76 virtual ~ ios_base ();
77};
78template < typename, typename > class istreambuf_iterator
79{
80 typedef A < char_traits < wchar_t > >istream_type;
81};
82template < typename, typename > class ostreambuf_iterator
83{
84 typedef basic_ostream < wchar_t, char_traits < wchar_t > >ostream_type;
85};
86template < typename, typename > class num_get:locale::facet
87{
88public:
89 typedef istreambuf_iterator < wchar_t > iter_type;
90};
91template < typename, typename > class num_put:locale::facet
92{
93public:
94 typedef ostreambuf_iterator < wchar_t > iter_type;
95};
96template < typename, typename > class basic_ios:ios_base
97{
98 typedef wchar_t char_type;
99 basic_ostream < wchar_t, char_traits < wchar_t > >*_M_tie;
100 char_type _M_fill;
101 bool _M_fill_init;
102 basic_streambuf < wchar_t, char_traits < wchar_t > >*_M_streambuf;
103 ctype < wchar_t > *_M_ctype;
104 num_put < wchar_t > *_M_num_put;
105 num_get < wchar_t > *_M_num_get;
106};
107template < typename, typename > class basic_ostream:virtual basic_ios < wchar_t,
108 char_traits < wchar_t >
109 >
110{
111 typedef basic_ios __ios_type;
112};
113template < typename > class A:basic_ios < wchar_t, int >
114{
115};
116class B:A < char_traits < wchar_t > >, basic_ostream < wchar_t,
117 char_traits < wchar_t > >
118{
119};
120}
121
122class C:
123 std::num_put <
124 wchar_t >
125{
126public:
127 C (int);
128 iter_type
129 do_put_out;
130};
131class
132 D:
133 std::num_get <
134 wchar_t >
135{
136public:
137 D (int);
138 iter_type
139 do_get_in;
140};
141template < typename > void
142install_formatting_facets (std::locale, int p2)
143{
144 (C (p2));
145}
146
147template < typename > void
148install_parsing_facets (std::locale, int p2)
149{
150 (D (p2));
151}
152
153std::locale a;
154int b;
155void
156create_formatting ()
157{
158 install_formatting_facets < wchar_t > (a, b);
159 install_parsing_facets < wchar_t > (a, b);
160}
This page took 3.848699 seconds and 5 git commands to generate.