Why should the access of member of A in inheritance chain D->B,C->A cause ambiguity? [duplicate]

  ambiguity, c++, multiple-inheritance

I tried to compile the following code

struct A{
    int a;
};

struct B : A{};

struct C : A{};

struct D: B,C{
    void f(){
        ++B::A::a;
    }
};

int main()
{}

The compilation of this code resulted in ambiguity error in both clang and gcc. I understand the ambiguity error when instead of ++B::A::a writing ++a. But why are we getting this error when accessing a explicitly? Where is this behavior defined in standard.

Source: Windows Questions C++

LEAVE A COMMENT