aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/TypeChecker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libsolidity/TypeChecker.cpp')
-rw-r--r--libsolidity/TypeChecker.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/libsolidity/TypeChecker.cpp b/libsolidity/TypeChecker.cpp
index f453e2fa..3fcedbda 100644
--- a/libsolidity/TypeChecker.cpp
+++ b/libsolidity/TypeChecker.cpp
@@ -43,8 +43,14 @@ bool TypeChecker::checkTypeRequirements(const ContractDefinition& _contract)
if (m_errors.empty())
throw; // Something is weird here, rather throw again.
}
-
- return m_errors.empty();
+ bool success = m_errors.empty();
+ for (auto const& it: m_errors)
+ if (!dynamic_cast<Warning const*>(it.get()))
+ {
+ success = false;
+ break;
+ }
+ return success;
}
TypePointer const& TypeChecker::type(Expression const& _expression) const
@@ -443,6 +449,18 @@ bool TypeChecker::visit(VariableDeclaration const& _variable)
{
if (_variable.value())
expectType(*_variable.value(), *varType);
+ else
+ {
+ if (auto ref = dynamic_cast<ReferenceType const *>(varType.get()))
+ if (ref->dataStoredIn(DataLocation::Storage) && _variable.isLocalVariable() && !_variable.isCallableParameter())
+ {
+ auto err = make_shared<Warning>();
+ *err <<
+ errinfo_sourceLocation(_variable.location()) <<
+ errinfo_comment("Uninitialized storage pointer. Did you mean '" + varType->toString(true) + " memory'?");
+ m_errors.push_back(err);
+ }
+ }
}
else
{