diff --git a/include/mio/detail/mmap.ipp b/include/mio/detail/mmap.ipp index a068891..2045cd1 100644 --- a/include/mio/detail/mmap.ipp +++ b/include/mio/detail/mmap.ipp @@ -324,8 +324,7 @@ void basic_mmap::map(const handle_type handle, } template -template -void basic_mmap::sync(std::error_code& error) +void basic_mmap::sync_impl(std::error_code& error) { error.clear(); if(!is_open()) diff --git a/include/mio/mmap.hpp b/include/mio/mmap.hpp index 2d18cd9..694d9f4 100644 --- a/include/mio/mmap.hpp +++ b/include/mio/mmap.hpp @@ -344,7 +344,10 @@ public: template< access_mode A = AccessMode, typename = typename std::enable_if::type - > void sync(std::error_code& error); + > void sync(std::error_code& error) + { + sync_impl(error); + } /** * All operators compare the address of the first byte and size of the two mapped @@ -375,6 +378,15 @@ private: conditional_sync(); template typename std::enable_if::type conditional_sync(); + + /** + * Due to MSVC's fragile SFINAE support (see + * https://github.com/mandreyel/mio/issues/300), we need to have `sync` + * defined inline so that `conditional_sync` sees the definition. To not + * clutter the API, the implementation is extracted into this non-SFINAE + * private member function. + */ + void sync_impl(std::error_code& error); }; template