-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Closed
Labels
bug 🐛should compile without errorError is reported even though it shouldn't. Source is fine.Error is reported even though it shouldn't. Source is fine.
Description
Description
For the following example
abstract contract A {
bool s;
function f() public view mod {
assert(s); // holds for C, but fails for B
}
modifier mod() virtual;
}
contract B is A {
modifier mod() virtual override {
s = false;
_;
}
}
contract C is B {
modifier mod() override {
s = true;
_;
}
}
The compiler reports the following warning:
Warning: Unreachable code.
--> /Users/mblicha/projects/solidity/build/test.sol:4:34:
|
4 | function f() public view mod {
| ^ (Relevant source part starts here and spans across multiple lines).
This warning is very confusing and most likely also incorrect. I would expect this to be compiled without any warning.
Environment
- Compiler version: 0.7.5, also current
develop - Target EVM version (as per compiler settings): N/A
- Framework/IDE (e.g. Truffle or Remix): N/A
- EVM execution environment / backend / blockchain client: N/A
- Operating system: MacOs 10.13
Steps to Reproduce
Just compile with solc.
Metadata
Metadata
Assignees
Labels
bug 🐛should compile without errorError is reported even though it shouldn't. Source is fine.Error is reported even though it shouldn't. Source is fine.