From ba43b70132b661d1b8d99af5258fca3567fe776c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 5 Sep 2013 16:59:46 -0700 Subject: [PATCH] Compile in strict-iterator mode under MSVC MSVC doesn't like operator->() returning a pointer to non-aggregate. So we must make sure that the expanded code does not try to call it by doing: abegin->~T(); Instead, we make an implicit call to operator T*() with that static_cast. If abegin is a non-strict iterator, it's already a T*, so the static_cast is a no-op. qvector.h(645) : error C2839: invalid return type 'int *' for overloaded 'operator ->' Change-Id: I06f983bab7677cb60ef3913cdce349e26896bfb6 Reviewed-by: Olivier Goffart --- src/corelib/tools/qvector.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 489ee821b93..4ff2b9f8e0d 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -634,7 +634,7 @@ typename QVector::iterator QVector::erase(iterator abegin, iterator aend) iterator moveEnd = d->end(); while (moveBegin != moveEnd) { if (QTypeInfo::isComplex) - abegin->~T(); + static_cast(abegin)->~T(); new (abegin++) T(*moveBegin++); } if (abegin < d->end()) {