Do Derived1::Base and Derived2::Base refer to the same type?
问题 MSVC, Clang and GCC disagree on this code: struct Base { int x; }; struct Der1 : public Base {}; struct Der2 : public Base {}; struct AllDer : public Der1, public Der2 { void foo() { Der1::Base::x = 5; } }; Godbolt GCC: <source>: In member function 'void AllDer::foo()': <source>:10:21: error: 'Base' is an ambiguous base of 'AllDer' 10 | Der1::Base::x = 5; | ^ Compiler returned: 1 Clang gives a similar error, and MSVC gives no error. Who is right here? I suppose this is covered in [class