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]

libstdc++/1734: Use of char_traits::_S_eos() in ostream manipulators will break with user-defined traits.



>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:

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