Merge from trunk r76354

(Fixes overflow detection, pointers casts)

[SVN r76355]
This commit is contained in:
Antony Polukhin
2012-01-08 09:05:35 +00:00
parent 82abf7b54f
commit a2e4606e6c
4 changed files with 145 additions and 11 deletions
+11
View File
@@ -796,6 +796,17 @@ void test_conversion_from_to_integral()
BOOST_CHECK_THROW(lexical_cast<T>("+-9"), bad_lexical_cast);
// test_conversion_from_to_integral_for_locale
// Overflow test case from David W. Birdsall
std::string must_owerflow_str = "160000000000000000000";
std::string must_owerflow_negative_str = "-160000000000000000000";
for (int i = 0; i < 15; ++i) {
BOOST_CHECK_THROW(lexical_cast<T>(must_owerflow_str), bad_lexical_cast);
BOOST_CHECK_THROW(lexical_cast<T>(must_owerflow_negative_str), bad_lexical_cast);
must_owerflow_str += '0';
must_owerflow_negative_str += '0';
}
typedef std::numpunct<char> numpunct;
restore_oldloc guard;