From 1eb7ddbb09b2ff3c65b6329962229ffcc10eaf03 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 5 Sep 2016 13:34:57 +0200 Subject: Make constant and payable mutually exclusive. --- libsolidity/analysis/TypeChecker.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libsolidity') diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index c948b90b..eea4619d 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -424,6 +424,8 @@ bool TypeChecker::visit(FunctionDefinition const& _function) if (!_function.isConstructor() && !_function.name().empty() && !_function.isPartOfExternalInterface()) typeError(_function.location(), "Internal functions cannot be payable."); } + if (_function.isPayable() && _function.isDeclaredConst()) + typeError(_function.location(), "Functions cannot be constant and payable at the same time."); for (ASTPointer const& var: _function.parameters() + _function.returnParameters()) { if (!type(*var)->canLiveOutsideStorage()) -- cgit