mirror of git://gcc.gnu.org/git/gcc.git
2002-03-05 Paolo Carlini <pcarlini@unitus.it>
libstdc++/5816
* include/bits/locale_facets.tcc
(num_get::_M_extract_float): Fix the parsing of __dec, since
the standard prescribes that if no grouping characters are
seen, no grouping check is applied.
* testsuite/22_locale/num_get_members_char.cc: Add test05
distilled from the PR.
* testsuite/22_locale/num_get_members_wchar_t.cc: Ditto.
From-SVN: r50317
This commit is contained in:
parent
170c56da73
commit
84eb48794c
|
|
@ -1,3 +1,14 @@
|
||||||
|
2002-03-05 Paolo Carlini <pcarlini@unitus.it>
|
||||||
|
|
||||||
|
libstdc++/5816
|
||||||
|
* include/bits/locale_facets.tcc
|
||||||
|
(num_get::_M_extract_float): Fix the parsing of __dec, since
|
||||||
|
the standard prescribes that if no grouping characters are
|
||||||
|
seen, no grouping check is applied.
|
||||||
|
* testsuite/22_locale/num_get_members_char.cc: Add test05
|
||||||
|
distilled from the PR.
|
||||||
|
* testsuite/22_locale/num_get_members_wchar_t.cc: Ditto.
|
||||||
|
|
||||||
2002-03-04 Craig Rodrigues <rodrigc@gcc.gnu.org>
|
2002-03-04 Craig Rodrigues <rodrigc@gcc.gnu.org>
|
||||||
|
|
||||||
* docs/html/17_intro/porting-howto.xml: Refer to
|
* docs/html/17_intro/porting-howto.xml: Refer to
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,10 @@ namespace std
|
||||||
}
|
}
|
||||||
else if (__c == __dec && !__found_dec)
|
else if (__c == __dec && !__found_dec)
|
||||||
{
|
{
|
||||||
|
// According to the standard, if no grouping chars are seen,
|
||||||
|
// no grouping check is applied. Therefore __found_grouping
|
||||||
|
// must be adjusted only if __dec comes after some __sep.
|
||||||
|
if (__found_grouping.size())
|
||||||
__found_grouping += static_cast<char>(__sep_pos);
|
__found_grouping += static_cast<char>(__sep_pos);
|
||||||
++__pos;
|
++__pos;
|
||||||
__xtrc += '.';
|
__xtrc += '.';
|
||||||
|
|
|
||||||
|
|
@ -390,12 +390,35 @@ void test04()
|
||||||
VERIFY( ul == 0776 );
|
VERIFY( ul == 0776 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// libstdc++/5816
|
||||||
|
void test05()
|
||||||
|
{
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
double d = 0.0;
|
||||||
|
|
||||||
|
istringstream iss;
|
||||||
|
locale loc_de("de_DE");
|
||||||
|
iss.imbue(loc_de);
|
||||||
|
|
||||||
|
const num_get<char>& ng = use_facet<num_get<char> >(iss.getloc());
|
||||||
|
const ios_base::iostate goodbit = ios_base::goodbit;
|
||||||
|
ios_base::iostate err = ios_base::goodbit;
|
||||||
|
|
||||||
|
iss.str("1234,5 ");
|
||||||
|
err = goodbit;
|
||||||
|
ng.get(iss.rdbuf(), 0, iss, err, d);
|
||||||
|
VERIFY( err == goodbit );
|
||||||
|
VERIFY( d == 1234.5 );
|
||||||
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
test01();
|
test01();
|
||||||
test02();
|
test02();
|
||||||
test03();
|
test03();
|
||||||
test04();
|
test04();
|
||||||
|
test05();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -391,6 +391,28 @@ void test04()
|
||||||
VERIFY( err == goodbit );
|
VERIFY( err == goodbit );
|
||||||
VERIFY( ul == 0776 );
|
VERIFY( ul == 0776 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// libstdc++/5816
|
||||||
|
void test05()
|
||||||
|
{
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
double d = 0.0;
|
||||||
|
|
||||||
|
wistringstream iss;
|
||||||
|
locale loc_de("de_DE");
|
||||||
|
iss.imbue(loc_de);
|
||||||
|
|
||||||
|
const num_get<wchar_t>& ng = use_facet<num_get<wchar_t> >(iss.getloc());
|
||||||
|
const ios_base::iostate goodbit = ios_base::goodbit;
|
||||||
|
ios_base::iostate err = ios_base::goodbit;
|
||||||
|
|
||||||
|
iss.str(L"1234,5 ");
|
||||||
|
err = goodbit;
|
||||||
|
ng.get(iss.rdbuf(), 0, iss, err, d);
|
||||||
|
VERIFY( err == goodbit );
|
||||||
|
VERIFY( d == 1234.5 );
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
|
@ -400,6 +422,7 @@ int main()
|
||||||
test02();
|
test02();
|
||||||
test03();
|
test03();
|
||||||
test04();
|
test04();
|
||||||
|
test05();
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue