aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2016-09-07 00:14:13 +0800
committerGitHub <noreply@github.com>2016-09-07 00:14:13 +0800
commitfbe0edb32c973166efbd5c0ac556f37fd38584d6 (patch)
treeb3ffbfdbb29a29b77a8ea403cf6e155cf9a0af46 /libsolidity
parente8cb4d28970befb4c3e5052078e1b13812a44256 (diff)
parent65c4e65cb3c8bf5ea1139fb7359e053824667c83 (diff)
downloaddexon-solidity-fbe0edb32c973166efbd5c0ac556f37fd38584d6.tar.gz
dexon-solidity-fbe0edb32c973166efbd5c0ac556f37fd38584d6.tar.zst
dexon-solidity-fbe0edb32c973166efbd5c0ac556f37fd38584d6.zip
Merge pull request #1019 from ethereum/constructor-modifier
Enforce constructor visibility
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index 41a5d39e..d9c54f75 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -80,6 +80,8 @@ bool TypeChecker::visit(ContractDefinition const& _contract)
typeError(function->returnParameterList()->location(), "Non-empty \"returns\" directive for constructor.");
if (function->isDeclaredConst())
typeError(function->location(), "Constructor cannot be defined as constant.");
+ if (function->visibility() != FunctionDefinition::Visibility::Public && function->visibility() != FunctionDefinition::Visibility::Internal)
+ typeError(function->location(), "Constructor must be public or internal.");
}
FunctionDefinition const* fallbackFunction = nullptr;