From 23074150f439d11fe37e2da3c032aa44cee24d15 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 11 Feb 2016 17:10:00 +0100 Subject: [PATCH] Test for segfault when using wrong number of constructor arguments. --- .../libsolidity/SolidityNameAndTypeResolution.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index d202942c6..3ca5a6b2b 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -3136,6 +3136,21 @@ BOOST_AUTO_TEST_CASE(conditional_with_all_types) BOOST_CHECK(success(text)); } +BOOST_AUTO_TEST_CASE(constructor_call_invalid_arg_count) +{ + // This caused a segfault in an earlier version + char const* text = R"( + contract C { + function C(){} + } + contract D is C { + function D() C(5){} + } + )"; + + BOOST_CHECK(expectError(text) == Error::Type::TypeError); +} + BOOST_AUTO_TEST_CASE(index_access_for_bytes) { char const* text = R"(