diff --git a/include/private/SkUniquePtr.h b/include/private/SkUniquePtr.h index d87ce29480..b1097d51eb 100644 --- a/include/private/SkUniquePtr.h +++ b/include/private/SkUniquePtr.h @@ -48,7 +48,7 @@ public: using deleter_type = D; private: - template ::value /*&& !is_final::value*/> + template struct compressed_base : private B { /*constexpr*/ compressed_base() : B() {} /*constexpr*/ compressed_base(const B& b) : B(b) {} @@ -68,25 +68,29 @@ private: void swap(compressed_base& that) /*noexcept*/ { SkTSwap(fb, that.fB); } }; - struct compressed_data : private compressed_base { + // C++14 adds '&& !std::is_final::value' to the bool condition. + // compressed_base_t exists and has this form to work around a bug in vs2013sp2-3 + using compressed_base_t = compressed_base::value>; + + struct compressed_data : private compressed_base_t { pointer fPtr; - /*constexpr*/ compressed_data() : compressed_base(), fPtr() {} + /*constexpr*/ compressed_data() : compressed_base_t(), fPtr() {} /*constexpr*/ compressed_data(const pointer& ptr, const deleter_type& d) - : compressed_base(d), fPtr(ptr) {} + : compressed_base_t(d), fPtr(ptr) {} template ::value && is_convertible::value >> /*constexpr*/ compressed_data(U1&& ptr, U2&& d) - : compressed_base(std::forward(d)), fPtr(std::forward(ptr)) {} + : compressed_base_t(std::forward(d)), fPtr(std::forward(ptr)) {} /*constexpr*/ pointer& getPointer() /*noexcept*/ { return fPtr; } /*constexpr*/ pointer const& getPointer() const /*noexcept*/ { return fPtr; } /*constexpr*/ deleter_type& getDeleter() /*noexcept*/ { - return compressed_base::get(); + return compressed_base_t::get(); } /*constexpr*/ deleter_type const& getDeleter() const /*noexcept*/ { - return compressed_base::get(); + return compressed_base_t::get(); } void swap(compressed_data& that) /*noexcept*/ { - compressed_base::swap(static_cast>(that)); + compressed_base_t::swap(static_cast(that)); SkTSwap(fPtr, that.fPtr); } }; @@ -221,8 +225,7 @@ public: using deleter_type = D; private: - template ::value /*&& !is_final::value*/> - struct compressed_base : private B { + template struct compressed_base : private B { /*constexpr*/ compressed_base() : B() {} /*constexpr*/ compressed_base(const B& b) : B(b) {} /*constexpr*/ compressed_base(B&& b) : B(std::move(b)) {} @@ -241,25 +244,29 @@ private: void swap(compressed_base& that) /*noexcept*/ { SkTSwap(fb, that.fB); } }; - struct compressed_data : private compressed_base { + // C++14 adds '&& !std::is_final::value' to the bool condition. + // compressed_base_t exists and has this form to work around a bug in vs2013sp2-3 + using compressed_base_t = compressed_base::value>; + + struct compressed_data : private compressed_base_t { pointer fPtr; - /*constexpr*/ compressed_data() : compressed_base(), fPtr() {} + /*constexpr*/ compressed_data() : compressed_base_t(), fPtr() {} /*constexpr*/ compressed_data(const pointer& ptr, const deleter_type& d) - : compressed_base(d), fPtr(ptr) {} + : compressed_base_t(d), fPtr(ptr) {} template ::value && is_convertible::value >> /*constexpr*/ compressed_data(U1&& ptr, U2&& d) - : compressed_base(std::forward(d)), fPtr(std::forward(ptr)) {} + : compressed_base_t(std::forward(d)), fPtr(std::forward(ptr)) {} /*constexpr*/ pointer& getPointer() /*noexcept*/ { return fPtr; } /*constexpr*/ pointer const& getPointer() const /*noexcept*/ { return fPtr; } /*constexpr*/ deleter_type& getDeleter() /*noexcept*/ { - return compressed_base::get(); + return compressed_base_t::get(); } /*constexpr*/ deleter_type const& getDeleter() const /*noexcept*/ { - return compressed_base::get(); + return compressed_base_t::get(); } void swap(compressed_data& that) /*noexcept*/ { - compressed_base::swap(static_cast>(that)); + compressed_base_t::swap(static_cast(that)); SkTSwap(fPtr, that.fPtr); } };