You need to change your inheritance definition for struct A1
:
struct A1: virtual A {
The reason, diamond inheritance ambiguity. struct D
is getting the method f()
from both A1
and B
. To inherit it only once, all qualifying classes must inherit the method virtually.