-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Closed
Labels
Description
Description
contract A {
uint x;
constructor() {
x = 42;
}
function f() public returns(uint256) {
return x;
}
}
contract B is A {
uint public y = f();
function g() public returns(uint256) {
return y;
}
}
// ----
// constructor() ->
// y() -> 0
// g() -> 0
// f() -> 0x2a
passes but it should not. What should not pass is the y() -> 0 and g() -> 0 parts. They should both equal 0x2a.
Funnily enough, this test reports correct results via yul i.e., new code gen. We already have a semantic test for it here (only for new code gen and ewasm) https://github.com/ethereum/solidity/blob/develop/test/libsolidity/semanticTests/constructor_inheritance_init_order.sol
Environment
- Compiler version: 23f03e1
- Target EVM version (as per compiler settings): Berlin
- EVM execution environment / backend / blockchain client: evm v0.4.0
Steps to Reproduce
$ isoltest -t test