diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-09-04 11:51:40 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-09-04 11:51:40 +0200 |
commit | 5fba3a9a0022c3647d098c00ea63593bd1e78e65 (patch) | |
tree | 21b0d100a31e59c4d0f2ebab1193741bee471537 /include/vcl/vclptr.hxx | |
parent | d3c93279667badf0c0feb927e9c46af97a538d84 (diff) |
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
Diffstat (limited to 'include/vcl/vclptr.hxx')
-rw-r--r-- | include/vcl/vclptr.hxx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/vcl/vclptr.hxx b/include/vcl/vclptr.hxx index b18872453ca0..407db34f67b5 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 |