solidity/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/try_declaration_err.sol
2022-04-01 23:41:18 -05:00

43 lines
1.4 KiB
Solidity

contract C {
struct S { bool f; }
S s;
function ext() external {}
function f() internal
{
S storage r;
try this.ext() { }
catch (bytes memory) { r = s; }
r;
}
function g() internal
{
S storage r;
try this.ext() { r = s; }
catch (bytes memory) { }
r;
}
function h() internal
{
S storage r;
try this.ext() {}
catch Error (string memory) { r = s; }
catch (bytes memory) { r = s; }
r;
}
function i() internal
{
S storage r;
try this.ext() { r = s; }
catch (bytes memory) { r; }
r = s;
r;
}
}
// ====
// EVMVersion: >=byzantium
// ----
// TypeError 3464: (206-207='r'): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour.
// TypeError 3464: (343-344='r'): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour.
// TypeError 3464: (526-527='r'): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour.
// TypeError 3464: (653-654='r'): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour.