| 1 |
// { dg-do assemble } |
| 2 |
//980519 bad error from nathan |
| 3 |
//$ egcs -fhonor-std -nostdinc -c redef.C |
| 4 |
//redef.C:56: redefinition of default argument for `class _Traits' |
| 5 |
|
| 6 |
template<class _CharT> struct char_traits; |
| 7 |
template<class _CharT> struct char_traits { }; |
| 8 |
template<> struct char_traits<char>; |
| 9 |
template<> struct char_traits<char> { }; |
| 10 |
|
| 11 |
template<class _CharT, class _Traits = char_traits<_CharT> > class istreambuf_iterator; |
| 12 |
|
| 13 |
|
| 14 |
template<class _CharT, class _Traits> |
| 15 |
class istreambuf_iterator |
| 16 |
{ |
| 17 |
public: |
| 18 |
typedef _Traits traits_type; |
| 19 |
class _Proxy; |
| 20 |
public: |
| 21 |
inline istreambuf_iterator() throw(); |
| 22 |
inline istreambuf_iterator(const _Proxy& __p) throw(); |
| 23 |
}; |
| 24 |
|
| 25 |
|
| 26 |
template <class _CharT, class _Traits> |
| 27 |
class istreambuf_iterator<_CharT,_Traits>::_Proxy |
| 28 |
{ |
| 29 |
public: |
| 30 |
_CharT operator*(); |
| 31 |
|
| 32 |
//bug -g++ w/ decl "redef", no decl no prob. |
| 33 |
//ok -edg: no warnings |
| 34 |
friend class istreambuf_iterator; // XXX OK? |
| 35 |
|
| 36 |
//bug -g++ w/ decl "redef", no decl no prob. |
| 37 |
//ok -edg: no warnings |
| 38 |
//friend class istreambuf_iterator<_CharT,_Traits>; |
| 39 |
|
| 40 |
//bug -g++ w/ decl "redef", no decl no prob. |
| 41 |
//ok -edg: declaration of "_CharT" and "_Traits" hides template parameter |
| 42 |
//template <class _CharT, class _Traits> friend class istreambuf_iterator; |
| 43 |
|
| 44 |
//ok -g++ |
| 45 |
//ok -edg |
| 46 |
//friend class istreambuf_iterator<_CharT>; |
| 47 |
|
| 48 |
}; |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
//explicit instantiation of a nested class |
| 53 |
template class istreambuf_iterator<char, char_traits<char> >::_Proxy; |
| 54 |
|