PR c++/81917 - ICE with void_t and partial specialization.
[official-gcc.git] / gcc / testsuite / g++.dg / opt / pr48272.C
blobcb28a1bb4e3a88c1a43309d080b5e6ebc348ab13
1 // { dg-do compile }
2 // { dg-options "-O3 -ftracer -fsched-pressure -Wno-unused-parameter -Wno-return-type" }
4 extern "C"
6   namespace std
7   {
8     class exception
9     {
10       virtual const char *what () const throw ();
11     };
12   }
14 namespace std __attribute__ ((__visibility__ ("default")))
16   template < typename _Alloc > class allocator;
17   template < class _CharT > struct char_traits;
18   template < typename _CharT, typename _Traits =
19     char_traits < _CharT >, typename _Alloc =
20     allocator < _CharT > >class basic_string;
21   typedef basic_string < char >string;
22   template < typename _CharT, typename _Traits =
23     char_traits < _CharT > >class basic_ios;
24   typedef basic_ios < char >ios;
27 namespace __gnu_cxx __attribute__ ((__visibility__ ("default")))
29   template < typename _Tp > class new_allocator
30   {
31   };
34 namespace std __attribute__ ((__visibility__ ("default")))
36 template < typename _Tp > class allocator:public __gnu_cxx::new_allocator <
37     _Tp >
38   {
39   };
42 typedef int _Atomic_word;
43 namespace __gnu_cxx __attribute__ ((__visibility__ ("default")))
45   static inline _Atomic_word
46     __attribute__ ((__unused__)) __exchange_and_add_dispatch (_Atomic_word *
47                                                               __mem,
48                                                               int __val)
49   {
50   }
53 namespace std __attribute__ ((__visibility__ ("default")))
55   template < typename _CharT, typename _Traits,
56     typename _Alloc > class basic_string
57   {
58     typedef _Alloc allocator_type;
59   private:struct _Rep_base
60     {
61       _Atomic_word _M_refcount;
62     };
63     struct _Rep:_Rep_base
64     {
65       void _M_dispose (const _Alloc & __a)
66       {
67         if (__builtin_expect (this != &_S_empty_rep (), false))
68           {
69             if (__gnu_cxx::
70                 __exchange_and_add_dispatch (&this->_M_refcount, -1) <= 0)
71               {
72                 _M_destroy (__a);
73               }
74           }
75       }
76       void _M_destroy (const _Alloc &) throw ();
77     };
78     struct _Alloc_hider:_Alloc
79     {
80       _CharT *_M_p;
81     };
82   private:mutable _Alloc_hider _M_dataplus;
83     _CharT *_M_data () const
84     {
85       return _M_dataplus._M_p;
86     }
87     _Rep *_M_rep () const
88     {
89       return &((reinterpret_cast < _Rep * >(_M_data ()))[-1]);
90     }
91     static _Rep & _S_empty_rep ()
92     {
93     }
94   public: basic_string ():_M_dataplus (_S_empty_rep ()._M_refdata (),
95                  _Alloc ())
96     {
97     }
98     basic_string (const _CharT * __s, const _Alloc & __a = _Alloc ());
99     ~basic_string ()
100     {
101       _M_rep ()->_M_dispose (this->get_allocator ());
102     }
103     allocator_type get_allocator () const
104     {
105     }
106   };
107   class ios_base
108   {
109   public:class failure:public exception
110     {
111     public:explicit failure (const string & __str) throw ();
112     };
113   };
114 template < typename _CharT, typename _Traits > class basic_ios:public
115     ios_base
116   {
117   };
118   namespace iostreams
119   {
120     class zlib_error:public std::ios::failure
121     {
122     public:explicit zlib_error (int error);
123     private:int error_;
124     };
125       zlib_error::zlib_error (int error):std::ios::failure ("zlib error"),
126       error_ (error)
127     {
128     }
129   }