Last active
March 27, 2018 01:24
-
-
Save okwme/9b79bddfcf2e4a372f9bf5da30440384 to your computer and use it in GitHub Desktop.
This demonstrates unexpected scope behavior in solidity when cloning structs.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.19; | |
pragma experimental ABIEncoderV2; | |
contract Tester { | |
struct Foo { | |
bool stayFalse; | |
} | |
function Tester() public { | |
} | |
function runTest() public constant returns (bool) { | |
Foo memory foo; | |
return one(foo); | |
} | |
function one(Foo memory foo) public constant returns (bool){ | |
Foo memory foobar; | |
foobar = two(foo); | |
return foo.stayFalse; | |
} | |
function two(Foo memory bar) public constant returns(Foo) { | |
bar.stayFalse = true; | |
return bar; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment