From c126edc6ea1c7af4d0a43e9d36a958f157d9b35c Mon Sep 17 00:00:00 2001 From: chriseth Date: Fri, 3 Mar 2017 18:44:35 +0100 Subject: Disallow uninitialized mapping variables. --- libsolidity/analysis/TypeChecker.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'libsolidity/analysis') diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index ff55ef1f..404ddf77 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -730,13 +730,16 @@ bool TypeChecker::visit(VariableDeclarationStatement const& _statement) if (auto ref = dynamic_cast(type(varDecl).get())) { if (ref->dataStoredIn(DataLocation::Storage)) - { warning( varDecl.location(), "Uninitialized storage pointer. Did you mean ' memory " + varDecl.name() + "'?" ); - } } + else if (dynamic_cast(type(varDecl).get())) + typeError( + varDecl.location(), + "Uninitialized mapping. Mappings cannot be created dynamically, you have to assign them from a state variable." + ); varDecl.accept(*this); return false; } -- cgit