Fully aware, that the question I am asking is outside the purview of the C++ Standard, I am curious to know why GCC throws the same error twice? I know why the error is there, but am looking forwards to understand why the duplication in error message.
#include <iostream>
using namespace std;
struct A{
virtual void f1() = 0;
};
struct B : A{
};
struct C : A{
void f1(){}
};
struct D : C, B{
void f2(){f1();}
};
int main(){}
Error:
prog.cpp: In member function ‘void D::f2()’:
prog.cpp:16: error: reference to ‘f1’ is ambiguous
prog.cpp:5: error: candidates are: virtual void A::f1()
prog.cpp:12: error: virtual void C::f1()
prog.cpp:16: error: reference to ‘f1’ is ambiguous
prog.cpp:5: error: candidates are: virtual void A::f1()
prog.cpp:12: error: virtual void C::f1()