|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r78211 - in branches/release: boost libs/conversion/test
From: antoshkka_at_[hidden]
Date: 2012-04-26 13:59:18
Author: apolukhin
Date: 2012-04-26 13:59:17 EDT (Thu, 26 Apr 2012)
New Revision: 78211
URL: http://svn.boost.org/trac/boost/changeset/78211
Log:
Merge from trunk:
* fixed #6812 (now converting "." to float type throws bad_lexical_cast)
Text files modified:
branches/release/boost/lexical_cast.hpp | 3 ++-
branches/release/libs/conversion/test/lexical_cast_float_types_test.cpp | 2 ++
2 files changed, 4 insertions(+), 1 deletions(-)
Modified: branches/release/boost/lexical_cast.hpp
==============================================================================
--- branches/release/boost/lexical_cast.hpp (original)
+++ branches/release/boost/lexical_cast.hpp 2012-04-26 13:59:17 EDT (Thu, 26 Apr 2012)
@@ -1062,9 +1062,10 @@
) return false;
#endif
- if(*begin == decimal_point){
+ if(*begin == decimal_point) {
++ begin;
found_decimal = true;
+ if (!found_number_before_exp && begin==end) return false;
continue;
}else {
if (!found_number_before_exp) return false;
Modified: branches/release/libs/conversion/test/lexical_cast_float_types_test.cpp
==============================================================================
--- branches/release/libs/conversion/test/lexical_cast_float_types_test.cpp (original)
+++ branches/release/libs/conversion/test/lexical_cast_float_types_test.cpp 2012-04-26 13:59:17 EDT (Thu, 26 Apr 2012)
@@ -261,6 +261,7 @@
BOOST_CHECK_THROW(lexical_cast<test_t>(".e"), bad_lexical_cast);
BOOST_CHECK_THROW(lexical_cast<test_t>(".11111111111111111111111111111111111111111111111111111111111111111111ee"), bad_lexical_cast);
BOOST_CHECK_THROW(lexical_cast<test_t>(".11111111111111111111111111111111111111111111111111111111111111111111e-"), bad_lexical_cast);
+ BOOST_CHECK_THROW(lexical_cast<test_t>("."), bad_lexical_cast);
BOOST_CHECK_THROW(lexical_cast<test_t>("-B"), bad_lexical_cast);
BOOST_CHECK_THROW(lexical_cast<test_t>("0xB"), bad_lexical_cast);
@@ -276,6 +277,7 @@
BOOST_CHECK_THROW(lexical_cast<test_t>("-"), bad_lexical_cast);
BOOST_CHECK_THROW(lexical_cast<test_t>('\0'), bad_lexical_cast);
BOOST_CHECK_THROW(lexical_cast<test_t>('-'), bad_lexical_cast);
+ BOOST_CHECK_THROW(lexical_cast<test_t>('.'), bad_lexical_cast);
}
template <class T>
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk