| 1 |
// PR tree-optimization/22444 |
| 2 |
// When creating SFT's, we shouldn't add the original variable |
| 3 |
// to the addressable vars list, because this may cause false aliasing |
| 4 |
// with the subvars leading to the subvars not being renamed when they should |
| 5 |
// { dg-do compile } |
| 6 |
// { dg-options "-O2 -Wno-return-type" } |
| 7 |
__extension__ typedef __PTRDIFF_TYPE__ ptrdiff_t; |
| 8 |
__extension__ typedef __SIZE_TYPE__ size_t; |
| 9 |
namespace std |
| 10 |
{ |
| 11 |
template<class _T1, class _T2> struct pair |
| 12 |
{ |
| 13 |
_T1 first; |
| 14 |
_T2 second; |
| 15 |
pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) { } |
| 16 |
}; |
| 17 |
} |
| 18 |
namespace __gnu_internal |
| 19 |
{ |
| 20 |
typedef char __one; |
| 21 |
template<typename _Tp> __one __test_type(int _Tp::*); |
| 22 |
} |
| 23 |
namespace std |
| 24 |
{ |
| 25 |
template<typename _Tp> struct ___is_pod |
| 26 |
{ |
| 27 |
enum { __value = (sizeof(__gnu_internal::__test_type<_Tp>(0))!= sizeof(__gnu_internal::__one)) }; |
| 28 |
}; |
| 29 |
template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t, typename _Pointer = _Tp*, typename _Reference = _Tp&> struct iterator |
| 30 |
{ }; |
| 31 |
template<typename _Iterator> struct iterator_traits |
| 32 |
{ |
| 33 |
typedef typename _Iterator::difference_type difference_type; |
| 34 |
}; |
| 35 |
template<typename _Iterator> class reverse_iterator : public iterator<typename iterator_traits<_Iterator>::iterator_category, typename iterator_traits<_Iterator>::value_type, typename iterator_traits<_Iterator>::difference_type, typename iterator_traits<_Iterator>::pointer, typename iterator_traits<_Iterator>::reference> |
| 36 |
{ |
| 37 |
typedef _Iterator iterator_type; |
| 38 |
typedef typename iterator_traits<_Iterator>::difference_type difference_type; |
| 39 |
typedef typename iterator_traits<_Iterator>::reference reference; |
| 40 |
reverse_iterator operator+(difference_type __n) const {} |
| 41 |
reverse_iterator& operator+=(difference_type __n) { } |
| 42 |
reference operator[](difference_type __n) const { } |
| 43 |
}; |
| 44 |
} |
| 45 |
namespace __gnu_cxx |
| 46 |
{ |
| 47 |
template<bool _Thread> class __pool; |
| 48 |
template<template <bool> class _PoolTp, bool _Thread> struct __common_pool_policy; |
| 49 |
template<typename _Tp> class __mt_alloc_base |
| 50 |
{ |
| 51 |
typedef ptrdiff_t difference_type; |
| 52 |
typedef _Tp* pointer; |
| 53 |
}; |
| 54 |
template<typename _Tp, typename _Poolp = __common_pool_policy<__pool, true> > class __mt_alloc : public __mt_alloc_base<_Tp> |
| 55 |
{ |
| 56 |
typedef size_t size_type; |
| 57 |
}; |
| 58 |
} |
| 59 |
namespace std |
| 60 |
{ |
| 61 |
template<typename _Tp> struct allocator:public __gnu_cxx::__mt_alloc<_Tp> |
| 62 |
{ |
| 63 |
template<typename _Tp1> struct rebind |
| 64 |
{ |
| 65 |
typedef allocator<_Tp1> other; |
| 66 |
}; |
| 67 |
}; |
| 68 |
template <class _Arg, class _Result> struct unary_function { }; |
| 69 |
template <class _Arg1, class _Arg2, class _Result> struct binary_function |
| 70 |
{ |
| 71 |
typedef _Arg2 second_argument_type; |
| 72 |
}; |
| 73 |
template <class _Tp> struct less : public binary_function<_Tp, _Tp, bool> |
| 74 |
{ |
| 75 |
bool operator()(const _Tp& __x, const _Tp& __y) const { } |
| 76 |
}; |
| 77 |
template <class _Tp> struct _Identity : public unary_function<_Tp,_Tp> { }; |
| 78 |
struct _Rb_tree_node_base |
| 79 |
{ |
| 80 |
typedef _Rb_tree_node_base* _Base_ptr; |
| 81 |
typedef const _Rb_tree_node_base* _Const_Base_ptr; |
| 82 |
_Base_ptr _M_right; |
| 83 |
static _Base_ptr _S_minimum(_Base_ptr __x) { } |
| 84 |
static _Base_ptr _S_maximum(_Base_ptr __x) { } |
| 85 |
}; |
| 86 |
template<typename _Val> struct _Rb_tree_node { }; |
| 87 |
template<typename _Tp> struct _Rb_tree_iterator |
| 88 |
{ |
| 89 |
typedef _Tp* pointer; |
| 90 |
typedef _Rb_tree_iterator<_Tp> _Self; |
| 91 |
typedef _Rb_tree_node_base::_Base_ptr _Base_ptr; |
| 92 |
pointer operator->() const { } |
| 93 |
_Self operator++(int) { } |
| 94 |
_Base_ptr _M_node; |
| 95 |
}; |
| 96 |
template<typename _Tp> struct _Rb_tree_const_iterator |
| 97 |
{ |
| 98 |
typedef const _Tp* pointer; |
| 99 |
typedef _Rb_tree_iterator<_Tp> iterator; |
| 100 |
typedef _Rb_tree_node_base::_Const_Base_ptr _Base_ptr; |
| 101 |
_Rb_tree_const_iterator(const iterator& __it) : _M_node(__it._M_node) { } |
| 102 |
_Base_ptr _M_node; |
| 103 |
}; |
| 104 |
template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc = allocator<_Val> > struct _Rb_tree |
| 105 |
{ |
| 106 |
typedef typename _Alloc::template rebind<std::_Rb_tree_node<_Val> >::other _Node_allocator; |
| 107 |
typedef _Rb_tree_node_base* _Base_ptr; |
| 108 |
typedef const _Rb_tree_node_base* _Const_Base_ptr; |
| 109 |
typedef std::_Rb_tree_node<_Val> _Rb_tree_node; |
| 110 |
typedef _Key key_type; |
| 111 |
typedef _Val value_type; |
| 112 |
typedef value_type* pointer; |
| 113 |
typedef _Rb_tree_node* _Link_type; |
| 114 |
template<typename _Key_compare, bool _Is_pod_comparator = std::___is_pod<_Key_compare>::__value> struct _Rb_tree_impl |
| 115 |
: _Node_allocator |
| 116 |
{ |
| 117 |
_Rb_tree_node_base _M_header; |
| 118 |
}; |
| 119 |
_Rb_tree_impl<_Compare> _M_impl; |
| 120 |
typedef _Rb_tree_iterator<value_type> iterator; |
| 121 |
typedef _Rb_tree_const_iterator<value_type> const_iterator; |
| 122 |
typedef std::reverse_iterator<iterator> reverse_iterator; |
| 123 |
pair<iterator,bool> insert_unique(const value_type& __x); |
| 124 |
}; |
| 125 |
template<class _Key, class _Compare, class _Alloc> class set |
| 126 |
{ |
| 127 |
typedef _Key key_type; |
| 128 |
typedef _Key value_type; |
| 129 |
typedef _Compare key_compare; |
| 130 |
typedef typename _Alloc::template rebind<_Key>::other _Key_alloc_type; |
| 131 |
typedef _Rb_tree<_Key, value_type, _Identity<value_type>, key_compare, _Key_alloc_type> _Rep_type; |
| 132 |
_Rep_type _M_t; |
| 133 |
typedef typename _Rep_type::const_iterator iterator; |
| 134 |
std::pair<iterator,bool> insert(const value_type& __x) |
| 135 |
{ |
| 136 |
std::pair<typename _Rep_type::iterator, bool> __p = _M_t.insert_unique(__x); |
| 137 |
return std::pair<iterator, bool>(__p.first, __p.second); |
| 138 |
} |
| 139 |
}; |
| 140 |
} |
| 141 |
template class std::set<int, std::less<int>, std::allocator<char> >; |