diff options
author | chriseth <chris@ethereum.org> | 2018-07-04 05:03:26 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-07-04 05:03:26 +0800 |
commit | 8ed3da1d5f744337ba96916d9648a6884a25a3e7 (patch) | |
tree | a1252005c3a5d1b950ccf77a8c6e7095fa394a72 /libsolidity/analysis | |
parent | 533d5d4b1cc4374decc704de8c86ad4cef6214fc (diff) | |
download | dexon-solidity-8ed3da1d5f744337ba96916d9648a6884a25a3e7.tar.gz dexon-solidity-8ed3da1d5f744337ba96916d9648a6884a25a3e7.tar.zst dexon-solidity-8ed3da1d5f744337ba96916d9648a6884a25a3e7.zip |
Only allow compile-time constants for constant state variables.
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 3bd0b4c1..676b3cd6 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -749,19 +749,10 @@ bool TypeChecker::visit(VariableDeclaration const& _variable) if (!_variable.value()) m_errorReporter.typeError(_variable.location(), "Uninitialized \"constant\" variable."); else if (!_variable.value()->annotation().isPure) - { - if (_variable.sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::V050)) - m_errorReporter.typeError( - _variable.value()->location(), - "Initial value for constant variable has to be compile-time constant." - ); - else - m_errorReporter.warning( - _variable.value()->location(), - "Initial value for constant variable has to be compile-time constant. " - "This will fail to compile with the next breaking version change." - ); - } + m_errorReporter.typeError( + _variable.value()->location(), + "Initial value for constant variable has to be compile-time constant." + ); } if (!_variable.isStateVariable()) { |