[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / g++.dg / debug / pr71432.C
blobe9bc88ca863a6e8e4de8f685dcfc401bcfb31fc2
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fcompare-debug" } */
3 /* { dg-xfail-if "" { powerpc-ibm-aix* } } */
5 namespace std
7   typedef long unsigned int size_t;
8   inline namespace __cxx11
9   {
10   } }
12 extern "C++"
14   namespace std
15   {
16     template < typename _Tp > struct __is_char
17     {
18     };
19     template <> struct __is_char <char >
20     {
21       enum
22         { __value = 1 };
23     };
24   } namespace __gnu_cxx
25   {
26     template < bool, typename > struct __enable_if
27     {
28     };
29     template < typename _Tp > struct __enable_if <true, _Tp >
30     {
31       typedef _Tp __type;
32     };
33   }
36 namespace __gnu_cxx
38   template < typename _Tp > class new_allocator
39   {
40   };
43 namespace std
45   template < typename _Tp > using __allocator_base =
46     __gnu_cxx::new_allocator < _Tp >;
47 template < typename _Tp > class allocator:public __allocator_base < _Tp >
48   {
49   };
50   template < typename _Alloc > struct allocator_traits
51   {
52   };
53   template < typename _Tp > struct allocator_traits <allocator < _Tp >>
54   {
55     using size_type = std::size_t;
56     template < typename _Up > using rebind_alloc = allocator < _Up >;
57   };
60 namespace __gnu_cxx
62   template < typename _Alloc > struct __alloc_traits:std::allocator_traits <_Alloc >
63   {
64     typedef std::allocator_traits < _Alloc > _Base_type;
65      template < typename _Tp > struct rebind
66     {
67       typedef typename _Base_type::template rebind_alloc < _Tp > other;
68      };
69    };
72 namespace std
74   template < class _CharT > struct char_traits;
75   namespace __cxx11
76   {
77     template < typename _CharT, typename _Traits =
78       char_traits < _CharT >, typename _Alloc =
79       allocator < _CharT > >class basic_string;
80     typedef basic_string < char >string;
81   }
84 namespace std
86   template <> struct char_traits <char >
87   {
88     typedef char char_type;
89      static int compare (const char_type * __s1, const char_type * __s2,
90                           size_t __n)
91     {
92       return __builtin_memcmp (__s1, __s2, __n);
93     }
94   };
96   namespace __cxx11
97   {
98     template < typename _CharT, typename _Traits, typename _Alloc >
99     class basic_string
100     {
101       typedef typename __gnu_cxx::__alloc_traits <_Alloc >::template rebind < _CharT >::other _Char_alloc_type;
102       typedef __gnu_cxx::__alloc_traits < _Char_alloc_type > _Alloc_traits;
103       typedef typename _Alloc_traits::size_type size_type;
105     public:
106       size_type size ()const noexcept
107       {
108         return 0;
109       }
110       const _CharT *data () const noexcept
111       {
112         return 0;
113       }
114     };
115   }
117   template < typename _CharT > inline typename __gnu_cxx::__enable_if <
118     __is_char < _CharT >::__value,
119     bool >::__type operator== (const basic_string < _CharT > &__lhs,
120                                const basic_string < _CharT > &__rhs) noexcept
121   {
122     return !std::char_traits < _CharT >::compare (__lhs.data (),
123                                                    __rhs.data (),
124                                                    __lhs.size ());
125   }
128 class CLIParameterType
130   const std::string & getSwitchOption (unsigned int i) const
131   {
132     static std::string a;
133     return a;
134   }
135   unsigned int getSwitchOptionCount () const
136   {
137     return 0;
138   }
139   int checkSwitched (const std::string & value) const;
143 CLIParameterType::checkSwitched (const std::string & value) const
145   int contains = false;
146   for (unsigned int i = 0; !contains && i < getSwitchOptionCount () ;)
147     contains = getSwitchOption (i) == value;
149   return 0;