Fix #1479 -- member_function_pointer_kernel_1.h does not compile with MSVC /vms (#1481)

Add the __virtual_inheritance keyword to dummy struct when compiling with MSVC.
This commit is contained in:
NiklasRosenstein 2018-09-13 14:07:30 +02:00 committed by Davis E. King
parent 7b006f3769
commit 65a73ea7a4
1 changed files with 12 additions and 1 deletions

View File

@ -116,8 +116,19 @@ namespace dlib
}
};
// MSVC with the /vms option, we get C2287 since the dummy class requires virtual
// inheritance. Adding the __virtual_inheritance specifier explicitly fixes the issue,
// but then Clang-CL no longer accepts it.
#if defined(_MSC_VER) && !defined(__clang__)
#define DLIB_MSVC_INHERITANCE_VIRTUAL __virtual_inheritance
#else
#define DLIB_MSVC_INHERITANCE_VIRTUAL
#endif
struct dummy_base { virtual void nonnull() {}; virtual ~dummy_base(){}; int a; };
struct dummy : virtual public dummy_base{ void nonnull() {}; };
struct DLIB_MSVC_INHERITANCE_VIRTUAL dummy : virtual public dummy_base{ void nonnull() {}; };
#undef DLIB_MSVC_INHERITANCE_VIRTUAL
typedef mp_impl_T<mp_null<dummy> > mp_null_impl;
public: