mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Add the __virtual_inheritance keyword to dummy struct when compiling with MSVC.
This commit is contained in:
parent
7b006f3769
commit
65a73ea7a4
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user