libstdc++/9580: basic_filebuf<> with custom traits_type fails to link

Paolo Carlini
Thu Feb 13 21:40:00 GMT 2003

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, 
undefined reference to `std::basic_filebuf<char, 
/tmp/ccVSVF9A.o: In function `std::basic_filebuf<char, MyTraits>::uflow()':
undefined reference to `std::basic_filebuf<char, 

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

Now, in the current std_fstream.h there is:

  // Explicit specialization declarations, defined in src/
    basic_filebuf<char>::_M_underflow_common(bool __bump);

    basic_filebuf<wchar_t>::_M_underflow_common(bool __bump);

  // 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?

More information about the Gcc-bugs mailing list