substitution for std::char_traits<char> in mangled name issue
zibi at ca.ibm.com
zibi at ca.ibm.com
Mon Sep 30 20:42:44 UTC 2002
Hi all,
I just came across an issue with the name mangling schema used be g++ v.
3.2. Consider the following source:
namespace std {
template < class C > struct char_traits { };
template<typename _CharT, typename _Traits> class basic_ios { };
template<typename _CharT, typename _Traits = char_traits<_CharT> >
class basic_ostream : virtual public basic_ios<_CharT, _Traits>
{
public:
typedef basic_ios<_CharT, _Traits> __ios_type;
typedef basic_ostream<_CharT, _Traits> __ostream_type;
virtual
~basic_ostream() { }
__ostream_type& operator<<(__ios_type& (*__pf)(__ios_type&)) {
return *((__ostream_type*)0); }
};
}
using namespace std;
basic_ios<char, char_traits<char> >& foo(basic_ios<char, char_traits<char>
>& b) { return b; }
int main() {
basic_ostream<char, char_traits<char> > bo;
bo << &foo;
return 0;
}
The mangle name genrated by g++ for std::basic_ostream::operator<< (the one
in bold above) is _ZNSolsEPFRSt9basic_iosIcSt11char_traitsIcEES3_E. Should
it be
_ZNSolsEPFRSt9basic_iosIcS1_ES4_E?
The reason I question this substitution schema in the name mangling is
because when I changed the namespace std to stdd then I got :
_ZN4stdd13basic_ostreamIcNS_11char_traitsIcEEElsEPFRNS_9basic_iosIcS2_EES6_E
which indicates that stdd::char_traits<char> has been substituted with S2_
but why std::char_traits<char> is not substituted in the case with std
namespace? Is this a nonconformance to API spec or there is a special
encoding for std::char_traits<char>?
Regards, ______________________________________
Zbigniew Sarbinowski (Zibi) C++ for AS/400 developer
Tel. 905-413-6071; Internet: zibi at ca.ibm.com
8200 Warden Ave. Markham ON, L6G 1C7; C2/712/8200/MKM
More information about the cxx-abi-dev
mailing list