Merge pull request #4777 from ethereum/typeConversionMemory

Defaul data location for type conversions is memory.
This commit is contained in:
chriseth
2018-08-14 11:36:19 +02:00
committed by GitHub
5 changed files with 14 additions and 5 deletions
@@ -0,0 +1,5 @@
contract test {
function f() public pure returns (bytes) {
return bytes("abc");
}
}
@@ -2,4 +2,4 @@ contract C {
string s = string("\xa0\x00");
}
// ----
// TypeError: (28-46): Explicit type conversion not allowed from "literal_string (contains invalid UTF-8 sequence at position 0)" to "string storage pointer".
// TypeError: (28-46): Explicit type conversion not allowed from "literal_string (contains invalid UTF-8 sequence at position 0)" to "string memory".
@@ -4,4 +4,4 @@ contract C {
}
}
// ----
// TypeError: (52-65): Explicit type conversion not allowed from "literal_string "abc"" to "string storage pointer".
// Warning: (52-65): Statement has no effect.