aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis
diff options
context:
space:
mode:
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index 75530739..41636db7 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -473,6 +473,14 @@ bool TypeChecker::visit(VariableDeclaration const& _variable)
{
if (!_variable.isStateVariable())
typeError(_variable.location(), "Illegal use of \"constant\" specifier.");
+ if (!_variable.type()->isValueType())
+ {
+ bool allowed = false;
+ if (auto arrayType = dynamic_cast<ArrayType const*>(_variable.type().get()))
+ allowed = arrayType->isString();
+ if (!allowed)
+ typeError(_variable.location(), "Constants of non-value type not yet implemented.");
+ }
if (!_variable.value())
typeError(_variable.location(), "Uninitialized \"constant\" variable.");
else if (!_variable.value()->annotation().isPure)