path: root/src/corelib/tools/tools.pri
diff options
authorThiago Macieira <>2014-01-22 11:13:44 -0800
committerThe Qt Project <>2014-01-23 18:36:33 +0100
commit614589d844921e351e5422ba4a9b55aac22566c5 (patch)
treee8fed4feee59a8b4e43838621be8d12bd28cc522 /src/corelib/tools/tools.pri
parentc695543f76715f1f7acef32102c325399d0953cf (diff)
Work around a binary incompatibility in MSVC
The fix in b8fe5e1bbc7f341d03d2704a6110d6e3240589bb (for bug QTBUG-27277) created two sets of begin() and end() functions for QVector. That was required because QTypedArrayData::iterator and QTypedArrayData::const_iterator have non-implicit copy constructors, which means the variants returning a strict iterator need to pass the storage pointer as an implicit first parameter. With the fix, the compiler would emit functions with two different names for each variant, which couldn't be merged. If we remove those copy constructors, the compiler might be able to generate the same code (no implicit first parameter) for both functions. Now, enter MSVC. Due to QPolygon, QVector<QPoint> and QVector<QPointF> are "extern templates". That is, the compiler is not allowed to inline anything, it must generate calls into QtCore (which we must fix for Qt 6, if we can). That means QtCore would only have one set of begin() / end() functions. If an application tried to use the other set by defining QT_STRICT_ITERATORS, you'd get a linker error for: ?begin@?$QVector@VQPoint@@@@QEAA?AViterator@?$QTypedArrayData@VQPoint@@@@V23@@Z (class QTypedArrayData<class QPoint>::iterator QGenericArray<class QPoint>::begin(class QTypedArrayData<class QPoint>::iterator)) Change-Id: I5c10a7d0a4855f4ba84056d313c6a800ecdcfe37 Reviewed-by: Friedemann Kleint <> Reviewed-by: Olivier Goffart <>
Diffstat (limited to 'src/corelib/tools/tools.pri')
1 files changed, 1 insertions, 0 deletions
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index a727315700..ba995b047d 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -115,6 +115,7 @@ SOURCES += \
NO_PCH_SOURCES = tools/qstring_compat.cpp
+msvc: NO_PCH_SOURCES += tools/qvector_msvc.cpp
false: SOURCES += $$NO_PCH_SOURCES # Hack for QtCreator
!nacl:mac: {