This compiles and works fine on Visual C ++ 2015 Update 3 RC:
class A { template <class T> void f() {} }; class B : A {}; class C : A {}; class D : B, C {}; int main() { D d; df<int>(); }
There are two problems in this code:
f() is private, so df<int>() should not compile.f() is ambiguous, as it can be B::f() or C::f() .
However, the diagnosis with /Wall and B::f() not called. The reverse order of D inherited from get C::f() , so I assume that it just uses the first base class in the list.
Both g ++ and clang get this right. Am I missing something or is this a bug in Visual C ++?
c ++ private multiple-inheritance visual-c ++ ambiguous
isanae
source share