aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/NameAndTypeResolver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libsolidity/NameAndTypeResolver.cpp')
-rw-r--r--libsolidity/NameAndTypeResolver.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/libsolidity/NameAndTypeResolver.cpp b/libsolidity/NameAndTypeResolver.cpp
index 96800ec3..c3b49abd 100644
--- a/libsolidity/NameAndTypeResolver.cpp
+++ b/libsolidity/NameAndTypeResolver.cpp
@@ -457,6 +457,14 @@ void ReferencesResolver::endVisit(VariableDeclaration& _variable)
}
else
{
+ if (_variable.isConstant())
+ {
+ if (loc != Location::Default && loc != Location::Memory)
+ BOOST_THROW_EXCEPTION(_variable.createTypeError(
+ "Storage location has to be \"memory\" (or unspecified) for constants."
+ ));
+ loc = Location::Memory;
+ }
if (loc == Location::Default)
loc = _variable.isCallableParameter() ? Location::Memory : Location::Storage;
bool isPointer = !_variable.isStateVariable();