From 2b00804d1df00fbd6ce26a9e34e8d2f24107988c Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 20 Oct 2016 11:33:17 +0200 Subject: [PATCH] Fix crash in throw. --- libsolidity/ast/Types.cpp | 2 +- test/libsolidity/SolidityNameAndTypeResolution.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index a412d421e..88bdee9ff 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -483,7 +483,7 @@ tuple RationalNumberType::isValidLiteral(Literal const& _literal !all_of(radixPoint + 1, _literal.value().end(), ::isdigit) || !all_of(_literal.value().begin(), radixPoint, ::isdigit) ) - throw; + return make_tuple(false, rational(0)); //Only decimal notation allowed here, leading zeros would switch to octal. auto fractionalBegin = find_if_not( radixPoint + 1, diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index f024c03ef..44ac1511d 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -4088,6 +4088,18 @@ BOOST_AUTO_TEST_CASE(using_directive_for_missing_selftype) BOOST_CHECK(expectError(text, false) == Error::Type::TypeError); } +BOOST_AUTO_TEST_CASE(invalid_fixed_point_literal) +{ + char const* text = R"( + contract A { + function a() { + .8E0; + } + } + )"; + BOOST_CHECK(expectError(text, false) == Error::Type::TypeError); +} + BOOST_AUTO_TEST_CASE(shift_constant_left_negative_rvalue) { char const* text = R"(