From 1afbabab32278fac416a8d3115dbad9d573bf142 Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Mon, 14 Jan 2013 18:59:43 +0000 Subject: Fix string conversions functions to throw out_of_range properly. Fixes http://llvm.org/bugs/show_bug.cgi?id=14919. llvm-svn: 172447 --- libcxx/test/strings/string.conversions/stof.pass.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'libcxx/test/strings/string.conversions/stof.pass.cpp') diff --git a/libcxx/test/strings/string.conversions/stof.pass.cpp b/libcxx/test/strings/string.conversions/stof.pass.cpp index 749d8672e5c..444a69518c6 100644 --- a/libcxx/test/strings/string.conversions/stof.pass.cpp +++ b/libcxx/test/strings/string.conversions/stof.pass.cpp @@ -32,23 +32,24 @@ int main() idx = 0; assert(std::stof(L"10g", &idx) == 10); assert(idx == 2); + idx = 0; try { assert(std::stof("1.e60", &idx) == INFINITY); - assert(idx == 5); + assert(false); } catch (const std::out_of_range&) { - assert(false); + assert(idx == 0); } try { assert(std::stof(L"1.e60", &idx) == INFINITY); - assert(idx == 5); + assert(false); } catch (const std::out_of_range&) { - assert(false); + assert(idx == 0); } idx = 0; try -- cgit v1.2.3