From a2962ba83cc77a85e3319fe6ebd1f449869eb87e Mon Sep 17 00:00:00 2001 From: Orvid King Date: Wed, 24 Feb 2016 16:28:14 -0800 Subject: [PATCH] Explicit vtordisp for MSVC Summary:Because sometimes things are just different. MSVC warns about the `dynamic_cast` done against this class because the class's declaration doesn't show that it would need a vtordisp. While I don't believe the `dynamic_cast` in question is actually called in either the constructor or destructor paths for the class, better to be safe and force the disp to be created. Reviewed By: yfeldblum Differential Revision: D2887490 Pulled By: Orvid fb-gh-sync-id: 821a6fc820087ac7120fffd9f8b95a26c2b4e71b shipit-source-id: 821a6fc820087ac7120fffd9f8b95a26c2b4e71b --- folly/io/async/AsyncSocket.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/folly/io/async/AsyncSocket.h b/folly/io/async/AsyncSocket.h index de1ca789..28c553a5 100644 --- a/folly/io/async/AsyncSocket.h +++ b/folly/io/async/AsyncSocket.h @@ -61,6 +61,13 @@ namespace folly { * responding and no further progress can be made sending the data. */ +#ifdef _MSC_VER +// We do a dynamic_cast on this, in +// AsyncTransportWrapper::getUnderlyingTransport so be safe and +// force displacements for it. See: +// https://msdn.microsoft.com/en-us/library/7sf3txa8.aspx +#pragma vtordisp(push, 2) +#endif class AsyncSocket : virtual public AsyncTransportWrapper { public: typedef std::unique_ptr UniquePtr; @@ -818,6 +825,8 @@ class AsyncSocket : virtual public AsyncTransportWrapper { BufferCallback* bufferCallback_{nullptr}; }; - +#ifdef _MSC_VER +#pragma vtordisp(pop) +#endif } // folly -- 2.34.1