Make constant and payable mutually exclusive.

This commit is contained in:
chriseth
2016-09-05 21:28:28 +02:00
parent 9c64edf110
commit 1eb7ddbb09
2 changed files with 10 additions and 0 deletions
+2
View File
@@ -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<VariableDeclaration> const& var: _function.parameters() + _function.returnParameters())
{
if (!type(*var)->canLiveOutsideStorage())