aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-07-05 23:07:32 +0800
committerGitHub <noreply@github.com>2018-07-05 23:07:32 +0800
commitf3e0bf1dd85fef29bf80f2235b5c0c19a6d30f31 (patch)
tree212f8cd521bf92aceb23cae7ab2fa69a63bab3a6 /libsolidity/analysis
parent2987e33e23bf8eb7283b9fd6f24eaa03c4771d7b (diff)
parent8ed3da1d5f744337ba96916d9648a6884a25a3e7 (diff)
downloaddexon-solidity-f3e0bf1dd85fef29bf80f2235b5c0c19a6d30f31.tar.gz
dexon-solidity-f3e0bf1dd85fef29bf80f2235b5c0c19a6d30f31.tar.zst
dexon-solidity-f3e0bf1dd85fef29bf80f2235b5c0c19a6d30f31.zip
Merge pull request #4418 from ethereum/initialConstants
Only allow compile-time constants for constant state variables.
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp17
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())
{