2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / lto / pr68811_1.C
blob1f5b356ba975cd784835bf1adee727b2c5441faa
1 // { dg-options "-O2 -flto -w" }
2 template <typename> class allocator;
3 template <typename _CharT, typename = _CharT, typename = allocator<_CharT>>
4 class Trans_NS___cxx11_basic_string;
5 struct __false_type {};
6 template <typename> using __void_t = void;
7 template <typename, typename, template <typename...> class, typename...>
8 struct __detector {
9   using type = int;
11 template <typename _Default, template <typename...> class _Op,
12           typename... _Args>
13 struct __detector<_Default, __void_t<_Op<_Args...>>, _Op, _Args...> {
14   using type = _Op<_Args...>;
16 template <typename _Default, template <typename...> class _Op,
17           typename... _Args>
18 using __detected_or = __detector<_Default, void, _Op, _Args...>;
19 template <typename _Default, template <typename...> class _Op,
20           typename... _Args>
21 using __detected_or_t = typename __detected_or<_Default, _Op, _Args...>::type;
22 template <template <typename...> class _Default,
23           template <typename...> class _Op, typename... _Args>
24 using __detected_or_t_ = __detected_or_t<_Default<_Args...>, _Op, _Args...>;
25 struct random_access_iterator_tag {};
26 class __undefined;
27 template <typename, typename> using __replace_first_arg_t = __undefined;
28 template <typename> class allocator {
29 public:
30   template <typename> struct rebind { typedef allocator other; };
32 struct __allocator_traits_base {
33   template <typename _Alloc, typename _Up>
34   using __rebind = typename _Alloc::template rebind<_Up>::other;
35   template <typename _Tp> using __pointer = typename _Tp::pointer;
36   template <typename _Tp> using __size_type = typename _Tp::size_type;
38 template <typename _Alloc, typename _Up>
39 using __alloc_rebind =
40     __detected_or_t_<__replace_first_arg_t, __allocator_traits_base::__rebind,
41                      _Alloc, _Up>;
42 struct allocator_traits : __allocator_traits_base {
43   using pointer = __detected_or_t<char, __pointer, allocator<char>>;
44   using size_type = __detected_or_t<int, __size_type, allocator<char>>;
45   template <typename _Tp>
46   using rebind_alloc = __alloc_rebind<allocator<char>, _Tp>;
48 struct __alloc_traits : allocator_traits {
49   struct rebind {
50     typedef rebind_alloc<int> other;
51   };
53 template <typename, typename, typename> class Trans_NS___cxx11_basic_string {
54 public:
55   struct _Alloc_hider : __alloc_traits::rebind::other {
56     _Alloc_hider(__alloc_traits::pointer, allocator);
57   } _M_dataplus;
58   __alloc_traits::pointer _M_local_data();
59   template <typename _InIterator>
60   void _M_construct_aux(_InIterator __beg, _InIterator __end, __false_type) {
61     _M_construct(__beg, __end, random_access_iterator_tag());
62   }
63   template <typename _InIterator>
64   void _M_construct(_InIterator __beg, _InIterator __end) {
65     _M_construct_aux(__beg, __end, __false_type());
66   }
67   template <typename _FwdIterator>
68   void _M_construct(_FwdIterator, _FwdIterator, random_access_iterator_tag);
69   char _S_copy___s2;
70   void _S_copy(char *, __alloc_traits::size_type __n) {
71     __builtin_memcpy(0, &_S_copy___s2, __n);
72   }
73   template <class _Iterator>
74   void _S_copy_chars(char *__p, _Iterator __k1, _Iterator __k2) {
75     _S_copy(__p, __k2 - __k1);
76   }
77   Trans_NS___cxx11_basic_string(char *__s,
78                                 allocator<char> __a = allocator<char>())
79       : _M_dataplus(_M_local_data(), __a) {
80     _M_construct(__s, __s);
81   }
83 template <typename _CharT, typename _Traits, typename _Alloc>
84 template <typename _InIterator>
85 void Trans_NS___cxx11_basic_string<_CharT, _Traits, _Alloc>::_M_construct(
86     _InIterator __beg, _InIterator __end, random_access_iterator_tag) {
87   _S_copy_chars(0, __beg, __end);
89 class Decimal {
90   Trans_NS___cxx11_basic_string<char> toString() const;
92 Trans_NS___cxx11_basic_string<char> Decimal::toString() const {
93   return "Infinity";