Merge pull request #1747 from ethereum/fixICEInternalConstructor

Move privateness of constructor into AST itself.
This commit is contained in:
Yoichi Hirai
2017-03-08 17:49:14 +01:00
committed by GitHub
7 changed files with 49 additions and 26 deletions
@@ -5101,6 +5101,24 @@ BOOST_AUTO_TEST_CASE(inconstructible_internal_constructor)
CHECK_ERROR(text, TypeError, "Contract with internal constructor cannot be created directly.");
}
BOOST_AUTO_TEST_CASE(inconstructible_internal_constructor_inverted)
{
// Previously, the type information for A was not yet available at the point of
// "new A".
char const* text = R"(
contract B {
A a;
function B() {
a = new A(this);
}
}
contract A {
function A(address a) internal {}
}
)";
CHECK_ERROR(text, TypeError, "Contract with internal constructor cannot be created directly.");
}
BOOST_AUTO_TEST_CASE(constructible_internal_constructor)
{
char const* text = R"(