Open
Description
Bugzilla Link | 43640 |
Version | trunk |
OS | Linux |
CC | @apolukhin,@dwblaikie,@DougGregor,@efriedma-quic,@zygoloid |
Extended Description
Consider the example:
struct A {
virtual int f() { return 0; }
virtual int g() { return f() + 40; }
};
struct B2 final : A {
int g() override;
};
int B2::g() { return A::g(); }
B2
is final, so any call to the virtual functions of A
end up with a call to the same function in B2
. So B2::g()
should inline the A::g()
and get optimized to:
int B2::g() { return B2::f() + 40; }
Which is just 40
, because B2::f()
always returns 0
.
Godbolt playground: https://godbolt.org/z/skqgH8