On 6/20/19 12:24 AM, Paolo Carlini wrote:
Hi,
this bug notices that the more aggressive de-virtualization check that
we have now in place (fixed c++/67184) doesn't work correctly for the
below reproducer, which involves a pure virtual: we de-virtualize and
the build fails at link-time. To cure this I believe we simply want an
additional DECL_PURE_VIRTUAL_P in the condition.
I don't see why this bug would be specific to pure virtual functions, so
the fix also should not be. If S1::f is not pure virtual, I'd expect
that we wrongly devirtualize to it in the same way.
Devirtualizing the call in S4 is a good optimization, we're just
selecting the wrong function.
It seems like the issue here is that the using-declaration hides the
final overrider from lookup. So we need to work harder to find the
actual final overrider, perhaps by looking into the argtype vtable.
Jason