This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
hmm: codecvt problem
- To: libstdc++-v3@cygnus.com, ncm@best.com
- Subject: hmm: codecvt problem
- From: Benjamin Kosnik <bkoz@cygnus.com>
- Date: Fri, 22 Jan 1999 17:55:39 -0800 (pst)
I had this:
result_type __r = _M_cvt->in(_M_state_cur,
_M_file->_IO_read_base,
_M_file->_IO_read_base + _M_buf_size,
_M_file->_IO_read_end,
_M_in_beg, _M_in_beg + _M_buf_size,
_M_in_end);
and it was giving me ammount of grief when I compiled with the new egcs:
c++ -DHAVE_CONFIG_H -I. -I../../src.libstdc++/src -I.. -nostdinc++
-I../../src.libstdc++ -I../../src.libstdc++/stl -fno-implicit-templates -g
-D_GNU_SOURCE -fimplicit-templates -c -fPIC -DPIC
../../src.libstdc++/src/misc-inst.cc
../../src.libstdc++/bits/std_fstream.h: In method `int
basic_filebuf<char,char_traits<char> >::underflow()':
../../src.libstdc++/src/misc-inst.cc:200: instantiated from here
../../src.libstdc++/bits/std_fstream.h:249: initializing non-const `const char
*&' with `char *' will use a temporary
../../src.libstdc++/bits/locfacets.h:592: in passing argument 4 of
`_Codecvt<char,char,mbstate_t>::in(mbstate_t &, const char *, const char *,
const char *&, char *, char *, char *&) const'
make: *** [misc-inst.lo] Error 1
so as a temporary hack, I added this:
result_type __r = _M_cvt->in(_M_state_cur,
_M_file->_IO_read_base,
_M_file->_IO_read_base + _M_buf_size,
const_cast<const char_type *&>(_M_file->_IO_read_end),
_M_in_beg, _M_in_beg + _M_buf_size,
_M_in_end);
which seems like quite the hack.. . what puzzles me is that the first code is
right out of the standard (27.8.1.4 Overridden virtual functions p 3)--what
gives?
-Benjamin