[Bug libstdc++/57704] New: std::char_traits<char>::lt is not standards-compliant
tudorb at fb dot com
gcc-bugzilla@gcc.gnu.org
Mon Jun 24 22:20:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57704
Bug ID: 57704
Summary: std::char_traits<char>::lt is not standards-compliant
Product: gcc
Version: 4.7.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: tudorb at fb dot com
Created attachment 30356
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30356&action=edit
simple example to illustrate the bug
The C++11 standard says in 21.2.3.1 (struct char_traits<char>):
"The two-argument members eq and lt shall be defined identically to the
built-in operators == and < for type unsigned char."
However, this is not the case if char is signed (tested using gcc 4.1.2, 4.6.2,
and 4.7.1 on x86_64, but the trunk version of char_traits.h is the same);
char_traits<char>::lt compares the two values as char, not as unsigned char.
The attached program should print 1 twice when this bug is fixed.
More information about the Gcc-bugs
mailing list