Radar · Solidity · Archive · Week 28 · Jul 6 – 12, 2026
Inheritance Order Reversal On Storage End Warning Bug
Worth knowingcompiler
- What changed
- The compiler’s warning about a custom storage layout being too close to the end of storage previously reversed the linearizedBaseContracts annotation when emitting the warning.
- Production impact
- The source does not say.
- Try it
- Compile a contract that triggers warning 3495 and check the warning message.
- Source
- soliditylang.org/blog/2026/07/09/inheritance-order-reversal-on-storage-end-warning-bug
Understand it, then run it
Run it now
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.37;
// This contract demonstrates that the inheritance order is now correct.
// In Solidity 0.8.35 the constructor would run in the wrong order,
// yielding x == 5 instead of 15.
contract A {
uint public x;
constructor() { x = 1; }
}
contract B is A {
constructor() { x = x * 10; }
}
contract C is B layout at 2**256 - 2**40 {
constructor() { x = x + 5; }
}
Tests
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.37;
import "./main.sol";
contract CTest {
C instance;
constructor() {
instance = new C();
}
function test_constructorOrder() public view {
require(instance.x() == 15, "constructor order wrong");
}
}
The test report when we ran it on Solidity 0.8.37 (solc)
1 of 1 tests passed.
- test_constructorOrder28,463 gas
- CTest: 711 bytes of bytecode, deployed for 232,930 gas
solc 0.8.37 · prague
Run sends this program (for Solidity, the contract and its tests) to our own sandbox, where it is compiled and run once, with no network, and what it printed or the test report comes back here. Nothing is kept. Runs are counted per visitor for the day so everyone gets a turn; the details are on the legal page.
Written by gpt-oss-20b from the linked source · claims checked against the sources · archive, not individually reviewed