Hi,
Compiling recent Qt (5.8 branch) fails due to failing member access in 
specialized copy & move constructors

The error is reported like this:
error: ‘ComPtr<B>::InterfaceType* ComPtr<B>::ptr_’ is protected within this 
context
     ComPtr(ComPtr<U>&& other) throw() : ptr_(other.ptr_) {
Luckily, these are easily fixed by using available accessor functions. Below is 
the proposed patch:
From b3bed37b043d83812a8b429ccef0c60dad5f4e24 Mon Sep 17 00:00:00 2001
From: Petri Hodju <petriho...@yahoo.com>
Date: Wed, 30 Nov 2016 15:30:36 +0200
Subject: [PATCH] Fix ComPtr protected member access in specialized template
 functions

---
 mingw-w64-headers/include/wrl/client.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/mingw-w64-headers/include/wrl/client.h 
b/mingw-w64-headers/include/wrl/client.h
index 83b4cb3..618bbf2 100644
--- a/mingw-w64-headers/include/wrl/client.h
+++ b/mingw-w64-headers/include/wrl/client.h
@@ -88,7 +88,7 @@ namespace Microsoft {
             }
 
             template<class U>
-            ComPtr(const ComPtr<U> &other) throw() : ptr_(other.ptr_) {
+            ComPtr(const ComPtr<U> &other) throw() : ptr_(other.Get()) {
                 InternalAddRef();
             }
 
@@ -98,8 +98,7 @@ namespace Microsoft {
             }
 
             template<class U>
-            ComPtr(ComPtr<U>&& other) throw() : ptr_(other.ptr_) {
-                other.ptr_ = nullptr;
+            ComPtr(ComPtr<U>&& other) throw() : ptr_(other.Detach()) {
             }
 
             ~ComPtr() throw() {
-- 
2.9.3

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to