The code on the SINK_ENTRY_INFO line has stopped compiling:

BEGIN_SINK_MAP(ControlEvents) SINK_ENTRY_INFO(0, *EventType, DISPID_Control_OnTimer, EVENT_OnTimer, EVENT_INFO_OnTimer()) END_SINK_MAP() 

after installing VS2015 Update 3 (although it is possible that he himself was somewhere wrong):

 error C2440: 'static_cast': cannot convert from '_atl_event_classtype *' to 'ATL::_IDispEventLocator<0,DIID__IControlEvents> *' 

where the parameters are defined:

 template<const IID* EventType> class ControlEvents : public IDispEventImpl<...> #define DISPID_Control_OnTimer 1 HRESULT __stdcall EVENT_OnTimer(IControl* sender, ITimerEvent* timer_event); static _ATL_FUNC_INFO* EVENT_INFO_OnTimer() { static _ATL_FUNC_INFO _EVENT_INFO_OnTimer = {CC_STDCALL, VT_EMPTY, 2, {VT_UNKNOWN, VT_UNKNOWN} }; return &_EVENT_INFO_OnTimer; } 

The code from atlcom.h itself looks like this:

 #define BEGIN_SINK_MAP(_class)\ typedef _class _GetSinkMapFinder;\ static const ATL::_ATL_EVENT_ENTRY<_class>* _GetSinkMap()\ {\ PTM_WARNING_DISABLE \ typedef _class _atl_event_classtype;\ static const ATL::_ATL_EVENT_ENTRY<_class> map[] = { #define SINK_ENTRY_INFO(id, iid, dispid, fn, info) {id, &iid, (int)(INT_PTR)(static_cast<ATL::_IDispEventLocator<id, &iid>*>((_atl_event_classtype*)8))-8, dispid, (void (__stdcall _atl_event_classtype::*)())fn, info}, #define SINK_ENTRY_EX(id, iid, dispid, fn) SINK_ENTRY_INFO(id, iid, dispid, fn, NULL) #define SINK_ENTRY(id, dispid, fn) SINK_ENTRY_EX(id, IID_NULL, dispid, fn) #define END_SINK_MAP() \ {0, NULL, 0, 0, NULL, NULL} }; return map;\ PTM_WARNING_RESTORE \ } 

Indeed, inside ATL there is a line like:

 static_cast<ATL::_IDispEventLocator<id, &iid>*>((_atl_event_classtype*)8))-8, dispid, (void (__stdcall _atl_event_classtype::*)())fn, info}, 

How to fix compilation error?

    1 answer 1

    Removed in atlcom.h file static_cast:

     #define SINK_ENTRY_INFO(id, iid, dispid, fn, info) {id, &iid, (int)(INT_PTR)((_atl_event_classtype*)8)-8, dispid, (void (__stdcall _atl_event_classtype::*)())fn, info}, 

    As a result, the program was compiled and even works without errors.

    It is most likely that VS2015 Update 3 contains an error in the C ++ compiler itself, because I did not see the reasons for not compiling the code (which was compiled without errors before the update).