This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
libstdc++/1734: Use of char_traits::_S_eos() in ostream manipulators will break with user-defined traits.
- To: gcc-gnats at gcc dot gnu dot org
- Subject: libstdc++/1734: Use of char_traits::_S_eos() in ostream manipulators will break with user-defined traits.
- From: bumgard at roguewave dot com
- Date: 22 Jan 2001 22:05:09 -0000
- Reply-To: bumgard at roguewave dot com
>Number: 1734
>Category: libstdc++
>Synopsis: Use of char_traits::_S_eos() in ostream manipulators will break with user-defined traits.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jan 22 14:06:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Gregory Bumgardner
>Release: 2.97
>Organization:
>Environment:
All
>Description:
The current implementation of the char_traits templates
in bits/char_traits.h each define a static member _S_eos()
that returns the end-of-string value for the specific
char_traits specialization. This method is used to
implement the eos output manipulator in bits/std_ostream.h.
In sections 27.6.1.3 and 27.6.2.7 of the standard state that
the eos manipulators shall use traits::eos() to determine the
eos value, but this method is not defined in section 21.1.2,
"Character Traits Requirements".
This discrepancy has been noted by the working group (see
http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-defects.html#13).
This defect report recommends that the traits::eos() call be
replaced with traits::char_type(0), which adheres to the
requirements of paragraph 17.2.2.1.3, "Character Sequences",
which states that the terminating character of all strings is
a null (zero) value.
>How-To-Repeat:
N/A
>Fix:
Remove _S_eos() methods from char_traits class and
specializations in bits/char_traits.h.
Change eos output manipulator implementation in bits/std_ostream.h
to use _Traits::char_type(0) instead of _Traits::_S_eos().
>Release-Note:
>Audit-Trail:
>Unformatted: