public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/51288] New: get_money implementation is missing the sentry object (does not skip leading whitespace)
@ 2011-11-23 20:14 cubbi at cubbi dot org
2011-11-23 22:52 ` [Bug libstdc++/51288] [C++0x] " paolo.carlini at oracle dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: cubbi at cubbi dot org @ 2011-11-23 20:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51288
Bug #: 51288
Summary: get_money implementation is missing the sentry object
(does not skip leading whitespace)
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: libstdc++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: cubbi@cubbi.org
The I/O manipulator std::get_money, as implemented so far, fails to skip
leading whitespace:
#include <iostream>
#include <sstream>
#include <locale>
#include <iomanip>
int main()
{
std::string str = " $1.23";
std::istringstream s1(str);
try {
s1.imbue(std::locale("en_US.UTF-8"));
long double val;
s1 >> std::get_money(val);
if(s1)
std::cout << val << '\n';
else
std::cout << "Bug\n";
} catch(...) {
std::cout << "Missing locale en_US.UTF-8, cannot run this test\n";
}
}
g++ 4.7.0 20111105 output:
Bug
clang++ 2.9/libc++-svn output:
123
The cause:
GCC implementation of operator>>(basic_istream<_CharT, _Traits>& __is,
_Get_money<_MoneyT> __f) calls __mg.get right away, but the standard says
§27.7.5/1
"The expression in >> get_money(mon, intl) described below behaves as a
formatted input function (27.7.2.2.1)."
§27.7.2.2.1/1
"Each formatted input function begins execution by constructing an object of
class sentry with the noskipws (second) argument false."
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/51288] [C++0x] get_money implementation is missing the sentry object (does not skip leading whitespace)
2011-11-23 20:14 [Bug libstdc++/51288] New: get_money implementation is missing the sentry object (does not skip leading whitespace) cubbi at cubbi dot org
@ 2011-11-23 22:52 ` paolo.carlini at oracle dot com
2011-11-23 23:20 ` paolo.carlini at oracle dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-11-23 22:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51288
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011-11-23
AssignedTo|unassigned at gcc dot |paolo.carlini at oracle dot
|gnu.org |com
Target Milestone|--- |4.7.0
Summary|get_money implementation is |[C++0x] get_money
|missing the sentry object |implementation is missing
|(does not skip leading |the sentry object (does not
|whitespace) |skip leading whitespace)
Ever Confirmed|0 |1
--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-11-23 21:13:22 UTC ---
Ok, let's add the sentry.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/51288] [C++0x] get_money implementation is missing the sentry object (does not skip leading whitespace)
2011-11-23 20:14 [Bug libstdc++/51288] New: get_money implementation is missing the sentry object (does not skip leading whitespace) cubbi at cubbi dot org
2011-11-23 22:52 ` [Bug libstdc++/51288] [C++0x] " paolo.carlini at oracle dot com
@ 2011-11-23 23:20 ` paolo.carlini at oracle dot com
2011-11-28 13:46 ` paolo at gcc dot gnu.org
2011-11-28 13:47 ` paolo.carlini at oracle dot com
3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-11-23 23:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51288
--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-11-23 21:16:37 UTC ---
put_money too of course.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/51288] [C++0x] get_money implementation is missing the sentry object (does not skip leading whitespace)
2011-11-23 20:14 [Bug libstdc++/51288] New: get_money implementation is missing the sentry object (does not skip leading whitespace) cubbi at cubbi dot org
2011-11-23 22:52 ` [Bug libstdc++/51288] [C++0x] " paolo.carlini at oracle dot com
2011-11-23 23:20 ` paolo.carlini at oracle dot com
@ 2011-11-28 13:46 ` paolo at gcc dot gnu.org
2011-11-28 13:47 ` paolo.carlini at oracle dot com
3 siblings, 0 replies; 5+ messages in thread
From: paolo at gcc dot gnu.org @ 2011-11-28 13:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51288
--- Comment #3 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2011-11-28 13:24:29 UTC ---
Author: paolo
Date: Mon Nov 28 13:24:23 2011
New Revision: 181775
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181775
Log:
2011-11-28 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/51288
* include/std/iomanip (get_money, put_money): Use sentry.
* testsuite/27_io/manipulators/extended/get_money/char/51288.cc: New.
* testsuite/27_io/manipulators/extended/get_money/wchar_t/51288.cc:
Likewise.
* testsuite/27_io/manipulators/extended/put_money/char/51288.cc:
Likewise.
* testsuite/27_io/manipulators/extended/put_money/wchar_t/51288.cc:
Likewise.
Added:
trunk/libstdc++-v3/testsuite/27_io/manipulators/extended/get_money/char/51288.cc
trunk/libstdc++-v3/testsuite/27_io/manipulators/extended/get_money/wchar_t/51288.cc
trunk/libstdc++-v3/testsuite/27_io/manipulators/extended/put_money/char/51288.cc
trunk/libstdc++-v3/testsuite/27_io/manipulators/extended/put_money/wchar_t/51288.cc
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/std/iomanip
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/51288] [C++0x] get_money implementation is missing the sentry object (does not skip leading whitespace)
2011-11-23 20:14 [Bug libstdc++/51288] New: get_money implementation is missing the sentry object (does not skip leading whitespace) cubbi at cubbi dot org
` (2 preceding siblings ...)
2011-11-28 13:46 ` paolo at gcc dot gnu.org
@ 2011-11-28 13:47 ` paolo.carlini at oracle dot com
3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-11-28 13:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51288
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-11-28 13:25:05 UTC ---
Fixed for 4.7.0.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-11-28 13:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-23 20:14 [Bug libstdc++/51288] New: get_money implementation is missing the sentry object (does not skip leading whitespace) cubbi at cubbi dot org
2011-11-23 22:52 ` [Bug libstdc++/51288] [C++0x] " paolo.carlini at oracle dot com
2011-11-23 23:20 ` paolo.carlini at oracle dot com
2011-11-28 13:46 ` paolo at gcc dot gnu.org
2011-11-28 13:47 ` paolo.carlini at oracle dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).