include/vcl/vclptr.hxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
New commits: commit 5fba3a9a0022c3647d098c00ea63593bd1e78e65 Author: Stephan Bergmann <[email protected]> Date: Fri Sep 4 11:51:40 2015 +0200 Prevent perfect forwarding ctor from hijacking copy construction attempts ...and hope that this will already be enough to help MSVC 2015 re. <http://paste.openstack.org/show/444734/>. "This leads to beavior that's intuitive only if you've spent so much time around compilers and compiler-writers, you've forgotten what it's like to be human," as Meyers so aptly put it. Change-Id: I4015bf831cd4cfed6988cc3517f719b756e27bb8 diff --git a/include/vcl/vclptr.hxx b/include/vcl/vclptr.hxx index b188724..407db34 100644 --- a/include/vcl/vclptr.hxx +++ b/include/vcl/vclptr.hxx @@ -371,6 +371,21 @@ public: : ScopedVclPtr<reference_type>( new reference_type(std::forward<Arg>(arg)...), SAL_NO_ACQUIRE ) { } + +private: + // Prevent the above perfect forwarding ctor from hijacking (accidental) + // attempts at ScopedVclPtrInstance copy construction (where the hijacking + // would typically lead to somewhat obscure error messages); both non-const + // and const variants are needed here, as the ScopedVclPtr base class has a + // const--variant copy ctor, so the implicitly declared copy ctor for + // ScopedVclPtrInstance would also be the const variant, so non-const copy + // construction attempts would be hijacked by the perfect forwarding ctor; + // but if we only declared a non-const variant here, the const variant would + // no longer be implicitly declared (as there would already be an explicitly + // declared copy ctor), so const copy construction attempts would then be + // hijacked by the perfect forwarding ctor: + ScopedVclPtrInstance(ScopedVclPtrInstance &) = delete; + ScopedVclPtrInstance(ScopedVclPtrInstance const &) = delete; }; #endif // INCLUDED_VCL_PTR_HXX _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
