| 1 |
/* { dg-do assemble } */ |
| 2 |
/* { dg-additional-options "-Wno-return-type" } */ |
| 3 |
|
| 4 |
/* Minimized from the testcase in PR c++/44473; mangling of decimal types |
| 5 |
did not include CV qualifiers. */ |
| 6 |
|
| 7 |
namespace std |
| 8 |
{ |
| 9 |
namespace decimal |
| 10 |
{ |
| 11 |
class decimal32 |
| 12 |
{ |
| 13 |
public: |
| 14 |
typedef float __decfloat32 __attribute__ ((mode (SD))); |
| 15 |
explicit decimal32 (float __r):__val (__r) {} |
| 16 |
private: |
| 17 |
__decfloat32 __val; |
| 18 |
}; |
| 19 |
}; |
| 20 |
|
| 21 |
template <typename _BI1, typename _BI2> |
| 22 |
_BI2 copy_backward (_BI1 __first, _BI2 __result); |
| 23 |
} |
| 24 |
|
| 25 |
namespace __gnu_cxx |
| 26 |
{ |
| 27 |
template <typename _Iterator, typename _Container> |
| 28 |
class __normal_iterator |
| 29 |
{ |
| 30 |
public: |
| 31 |
explicit __normal_iterator (const _Iterator & __i) {} |
| 32 |
const _Iterator & base () const {} |
| 33 |
}; |
| 34 |
|
| 35 |
template <typename _IteratorL, typename _IteratorR, typename _Container> |
| 36 |
bool operator== (const __normal_iterator <_IteratorL, _Container> &__lhs, |
| 37 |
const __normal_iterator <_IteratorR, _Container> &__rhs) |
| 38 |
{ |
| 39 |
return __lhs.base () == __rhs.base (); |
| 40 |
} |
| 41 |
|
| 42 |
template <typename _Tp> |
| 43 |
class new_allocator |
| 44 |
{ |
| 45 |
public: |
| 46 |
typedef _Tp *pointer; |
| 47 |
typedef const _Tp *const_pointer; |
| 48 |
template <typename _Tp1> |
| 49 |
struct rebind |
| 50 |
{ |
| 51 |
typedef new_allocator <_Tp1> other; |
| 52 |
}; |
| 53 |
}; |
| 54 |
} |
| 55 |
|
| 56 |
namespace std |
| 57 |
{ |
| 58 |
template <typename _Tp> |
| 59 |
class allocator:public __gnu_cxx::new_allocator <_Tp> {}; |
| 60 |
|
| 61 |
template <typename _Tp, typename _Alloc> |
| 62 |
struct _Vector_base |
| 63 |
{ |
| 64 |
typedef typename _Alloc::template rebind <_Tp>::other _Tp_alloc_type; |
| 65 |
struct _Vector_impl:public _Tp_alloc_type |
| 66 |
{ |
| 67 |
typename _Tp_alloc_type::pointer _M_finish; |
| 68 |
}; |
| 69 |
public: _Vector_impl _M_impl; |
| 70 |
}; |
| 71 |
|
| 72 |
template <typename _Tp, typename _Alloc = std::allocator <_Tp> > |
| 73 |
class vector:protected _Vector_base <_Tp, _Alloc> |
| 74 |
{ |
| 75 |
typedef _Vector_base <_Tp, _Alloc> _Base; |
| 76 |
typedef typename _Base::_Tp_alloc_type _Tp_alloc_type; |
| 77 |
public: |
| 78 |
typedef _Tp value_type; |
| 79 |
typedef typename _Tp_alloc_type::pointer pointer; |
| 80 |
typedef typename _Tp_alloc_type::const_pointer const_pointer; |
| 81 |
typedef __gnu_cxx::__normal_iterator <pointer, vector> iterator; |
| 82 |
typedef __gnu_cxx::__normal_iterator <const_pointer, vector> |
| 83 |
const_iterator; |
| 84 |
const_iterator begin () const; |
| 85 |
iterator end () |
| 86 |
{ |
| 87 |
return iterator (this->_M_impl._M_finish); |
| 88 |
} |
| 89 |
const_iterator end () const |
| 90 |
{ |
| 91 |
return const_iterator (this->_M_impl._M_finish); |
| 92 |
} |
| 93 |
bool empty () const |
| 94 |
{ |
| 95 |
return begin () == end (); |
| 96 |
} |
| 97 |
void push_back (const value_type & __x) |
| 98 |
{ |
| 99 |
_M_insert_aux (end ()); |
| 100 |
} |
| 101 |
void _M_insert_aux (iterator __position); |
| 102 |
}; |
| 103 |
|
| 104 |
template <typename _Tp, typename _Alloc> |
| 105 |
void vector <_Tp, _Alloc>::_M_insert_aux (iterator __position) |
| 106 |
{ |
| 107 |
std::copy_backward (__position.base (), this->_M_impl._M_finish - 1); |
| 108 |
} |
| 109 |
} |
| 110 |
|
| 111 |
std::vector <std::decimal::decimal32> vec; |
| 112 |
|
| 113 |
int |
| 114 |
foo () |
| 115 |
{ |
| 116 |
return (vec.empty ()) ? 1 : 0; |
| 117 |
} |
| 118 |
|
| 119 |
bool |
| 120 |
bar () |
| 121 |
{ |
| 122 |
vec.push_back (std::decimal::decimal32 (0)); |
| 123 |
return true; |
| 124 |
} |