This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libstdc++/9580: basic_filebuf<> with custom traits_type failsto link


Gabriel Dos Reis wrote:

If I recall correctly, this change was made because of some
differences in the way a narrow character stream based on
char_traits<char> behaves and the way the general Traits may behave.
At that point, I seem to recall that the goal was to have a general
implementation of that function plus the special case. I'll have to
go back and check my logs, unless Benjamin has a better recollection.
Thanks Gaby. Well, I'd like to ask a little bit more help. Perhaps we are
on the right track.

The complete error message at link time is the following:

/tmp/ccVSVF9A.o: In function `std::basic_filebuf<char, MyTraits>::underflow()':
/tmp/ccVSVF9A.o(.gnu.linkonce.t._ZNSt13basic_filebufIc8MyTraitsE9underflowEv+0x15): undefined reference to `std::basic_filebuf<char, MyTraits>::_M_underflow_common(bool)'
/tmp/ccVSVF9A.o: In function `std::basic_filebuf<char, MyTraits>::uflow()':
/tmp/ccVSVF9A.o(.gnu.linkonce.t._ZNSt13basic_filebufIc8MyTraitsE5uflowEv+0x15): undefined reference to `std::basic_filebuf<char, MyTraits>::_M_underflow_common(bool)'

As you can see, underflow and uflow are missing the generic _M_underflow_common.

Now, in the current std_fstream.h there is:

// Explicit specialization declarations, defined in src/fstream.cc.
template<>
basic_filebuf<char>::int_type
basic_filebuf<char>::_M_underflow_common(bool __bump);

#ifdef _GLIBCPP_USE_WCHAR_T
template<>
basic_filebuf<wchar_t>::int_type
basic_filebuf<wchar_t>::_M_underflow_common(bool __bump);
#endif

// Generic definitions.
template <typename _CharT, typename _Traits>
typename basic_filebuf<_CharT, _Traits>::int_type
basic_filebuf<_CharT, _Traits>::underflow()
{ return _M_underflow_common(false); }

template <typename _CharT, typename _Traits>
typename basic_filebuf<_CharT, _Traits>::int_type
basic_filebuf<_CharT, _Traits>::uflow()
{ return _M_underflow_common(true); }

Naively, something seems suspect here: the *generic* underflow and uflow are still there!!

Shouldn't they be disposed too, for the time being, at least?
Paolo.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]