aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/SolidityNameAndTypeResolution.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-08-06 21:39:42 +0800
committerchriseth <c@ethdev.com>2015-08-07 23:50:54 +0800
commit4288543847307de17d7fbde393a1a3f647be5f05 (patch)
tree960de3a4df66b3c3b398b0e429c7006aff042652 /libsolidity/SolidityNameAndTypeResolution.cpp
parente0fbdd57e6ca44472850c05a74f56c7ed555cf2d (diff)
downloaddexon-solidity-4288543847307de17d7fbde393a1a3f647be5f05.tar.gz
dexon-solidity-4288543847307de17d7fbde393a1a3f647be5f05.tar.zst
dexon-solidity-4288543847307de17d7fbde393a1a3f647be5f05.zip
Disallow comparison for reference types.
Fixes #2690
Diffstat (limited to 'libsolidity/SolidityNameAndTypeResolution.cpp')
-rw-r--r--libsolidity/SolidityNameAndTypeResolution.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/libsolidity/SolidityNameAndTypeResolution.cpp b/libsolidity/SolidityNameAndTypeResolution.cpp
index e59217bf..ba5a5a60 100644
--- a/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -1899,6 +1899,18 @@ BOOST_AUTO_TEST_CASE(integer_boolean_operators)
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode3), TypeError);
}
+BOOST_AUTO_TEST_CASE(reference_compare_operators)
+{
+ char const* sourceCode1 = R"(
+ contract test { bytes a; bytes b; function() { a == b; } }
+ )";
+ BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode1), TypeError);
+ char const* sourceCode2 = R"(
+ contract test { struct s {uint a;}; s x; s y; function() { x == y; } }
+ )";
+ BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode2), TypeError);
+}
+
BOOST_AUTO_TEST_CASE(overwrite_memory_location_external)
{
char const* sourceCode = R"(