diff options
author | Lu Guanqun <guanqun.lu@gmail.com> | 2016-01-11 16:29:24 +0800 |
---|---|---|
committer | Lu Guanqun <guanqun.lu@gmail.com> | 2016-01-23 01:14:01 +0800 |
commit | 1cd32883117d7ae398b74797b7e33f077f6cd677 (patch) | |
tree | 96c7ad7e0b5cf34046d14de440cb3b8b41562253 /libsolidity/analysis | |
parent | 41039705ac1cb97e4174c735c160c3df5bc01722 (diff) | |
download | dexon-solidity-1cd32883117d7ae398b74797b7e33f077f6cd677.tar.gz dexon-solidity-1cd32883117d7ae398b74797b7e33f077f6cd677.tar.zst dexon-solidity-1cd32883117d7ae398b74797b7e33f077f6cd677.zip |
[cond-expr] add a test to assign memory to storage
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 8f1b2b9d..b4896b49 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -754,8 +754,12 @@ bool TypeChecker::visit(Conditional const& _conditional) TypePointer const& trueType = type(_conditional.trueExpression()); TypePointer const& falseType = type(_conditional.falseExpression()); - // we fake it as an equal operator, but any other comparison operator can work. - TypePointer commonType = trueType->binaryOperatorResult(Token::Equal, falseType); + TypePointer commonType; + if (*trueType == *falseType) + commonType = trueType; + else + // we fake it as an equal operator, but any other comparison operator can work. + TypePointer commonType = trueType->binaryOperatorResult(Token::Equal, falseType); if (!commonType) { typeError( |