From d5102c1db7cd2334e127ff684a6ecdd6aff156c6 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Fri, 17 Mar 2017 16:37:02 +0000 Subject: Disallow constructor in interfaces --- libsolidity/analysis/TypeChecker.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libsolidity/analysis') diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 3dffecdb..87951003 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -463,6 +463,9 @@ bool TypeChecker::visit(FunctionDefinition const& _function) typeError(_function.location(), "Functions in interfaces cannot have an implementation."); _function.body().accept(*this); } + if (_function.isConstructor()) + if (m_scope->contractKind() == ContractDefinition::ContractKind::Interface) + typeError(_function.location(), "Constructor cannot be defined in interfaces."); return false; } -- cgit