aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-08-14 17:36:19 +0800
committerGitHub <noreply@github.com>2018-08-14 17:36:19 +0800
commit6ca3973944546d1a5518274fea47e635a07f9ca5 (patch)
tree89905149f0c5c9e3b85e0259e739f0fba7d316de /libsolidity/analysis
parent3dd31b704af6c50bc56217fd07266f7872daaa44 (diff)
parentbd567a22c9e901d2c7ae73a63f63dc56896b9461 (diff)
downloaddexon-solidity-6ca3973944546d1a5518274fea47e635a07f9ca5.tar.gz
dexon-solidity-6ca3973944546d1a5518274fea47e635a07f9ca5.tar.zst
dexon-solidity-6ca3973944546d1a5518274fea47e635a07f9ca5.zip
Merge pull request #4777 from ethereum/typeConversionMemory
Defaul data location for type conversions is memory.
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index 8ee555ee..0ffe6636 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -1629,10 +1629,13 @@ bool TypeChecker::visit(FunctionCall const& _functionCall)
else
{
TypePointer const& argType = type(*arguments.front());
+ // Resulting data location is memory unless we are converting from a reference
+ // type with a different data location.
+ // (data location cannot yet be specified for type conversions)
+ DataLocation dataLoc = DataLocation::Memory;
if (auto argRefType = dynamic_cast<ReferenceType const*>(argType.get()))
- // do not change the data location when converting
- // (data location cannot yet be specified for type conversions)
- resultType = ReferenceType::copyForLocationIfReference(argRefType->location(), resultType);
+ dataLoc = argRefType->location();
+ resultType = ReferenceType::copyForLocationIfReference(dataLoc, resultType);
if (!argType->isExplicitlyConvertibleTo(*resultType))
m_errorReporter.typeError(
_functionCall.location(),