diff options
author | chriseth <c@ethdev.com> | 2015-08-04 17:06:57 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-08-04 17:06:57 +0800 |
commit | 56d5c3310628a1e90225062f0ed21c8378678d09 (patch) | |
tree | a20fea1c1a6ba249ccb4736c39347e8c0637b919 /AST.cpp | |
parent | 6daa27622a06ec7b8a4d67e4d8a1e2dcaa1be982 (diff) | |
download | dexon-solidity-56d5c3310628a1e90225062f0ed21c8378678d09.tar dexon-solidity-56d5c3310628a1e90225062f0ed21c8378678d09.tar.gz dexon-solidity-56d5c3310628a1e90225062f0ed21c8378678d09.tar.bz2 dexon-solidity-56d5c3310628a1e90225062f0ed21c8378678d09.tar.lz dexon-solidity-56d5c3310628a1e90225062f0ed21c8378678d09.tar.xz dexon-solidity-56d5c3310628a1e90225062f0ed21c8378678d09.tar.zst dexon-solidity-56d5c3310628a1e90225062f0ed21c8378678d09.zip |
Allow explicit conversions bytes <-> string.
Diffstat (limited to 'AST.cpp')
-rw-r--r-- | AST.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -844,9 +844,15 @@ void FunctionCall::checkTypeRequirements(TypePointers const*) BOOST_THROW_EXCEPTION(createTypeError("Exactly one argument expected for explicit type conversion.")); if (!isPositionalCall) BOOST_THROW_EXCEPTION(createTypeError("Type conversion cannot allow named arguments.")); - if (!m_arguments.front()->getType()->isExplicitlyConvertibleTo(*type.getActualType())) - BOOST_THROW_EXCEPTION(createTypeError("Explicit type conversion not allowed.")); m_type = type.getActualType(); + auto argType = m_arguments.front()->getType(); + 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) + m_type = ReferenceType::copyForLocationIfReference(argRefType->location(), m_type); + if (!argType->isExplicitlyConvertibleTo(*m_type)) + BOOST_THROW_EXCEPTION(createTypeError("Explicit type conversion not allowed.")); + return; } |