Skip to content

Instantly share code, notes, and snippets.

@alerdenisov
Created August 29, 2020 18:57
Show Gist options
  • Save alerdenisov/015c70d480a5c90c97176da2e6d85824 to your computer and use it in GitHub Desktop.
Save alerdenisov/015c70d480a5c90c97176da2e6d85824 to your computer and use it in GitHub Desktop.
Shadowing issue with named returns
pragma solidity 0.4.11;
contract A {
uint foo = 50;
/**
* @dev Public getter of private `foo` field
* @return Returns value of `foo`
*/
function GetFoo() constant returns (uint foo) {
return foo; // returns 0 not 50, because of shadowing
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment