diff options
Diffstat (limited to 'libstdc++-v3/include/bits/fstream.tcc')
-rw-r--r-- | libstdc++-v3/include/bits/fstream.tcc | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/libstdc++-v3/include/bits/fstream.tcc b/libstdc++-v3/include/bits/fstream.tcc index 18dbaf1caae..387f099ae98 100644 --- a/libstdc++-v3/include/bits/fstream.tcc +++ b/libstdc++-v3/include/bits/fstream.tcc @@ -90,11 +90,21 @@ namespace std { _M_allocate_internal_buffer(); _M_mode = __mode; + + // Setup initial position of buffer. _M_set_indeterminate(); + // Set input buffer to something real. + // NB: Must open in non-blocking way to do this, or must + // set the initial position in a different manner than + // using underflow. + if (__mode & ios_base::in && _M_buf_allocated) + this->underflow(); + if ((__mode & ios_base::ate) && this->seekoff(0, ios_base::end, __mode) < 0) this->close(); + __ret = this; } } @@ -477,13 +487,16 @@ namespace std // which are defined via explicit instantiations elsewhere. // NB: This syntax is a GNU extension. extern template class basic_filebuf<char>; - extern template class basic_filebuf<wchar_t>; extern template class basic_ifstream<char>; - extern template class basic_ifstream<wchar_t>; extern template class basic_ofstream<char>; - extern template class basic_ofstream<wchar_t>; extern template class basic_fstream<char>; + +#ifdef _GLIBCPP_USE_WCHAR_T + extern template class basic_filebuf<wchar_t>; + extern template class basic_ifstream<wchar_t>; + extern template class basic_ofstream<wchar_t>; extern template class basic_fstream<wchar_t>; +#endif } // namespace std #endif |