From 614589d844921e351e5422ba4a9b55aac22566c5 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 22 Jan 2014 11:13:44 -0800 Subject: 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 and QVector 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::iterator QGenericArray::begin(class QTypedArrayData::iterator)) Change-Id: I5c10a7d0a4855f4ba84056d313c6a800ecdcfe37 Reviewed-by: Friedemann Kleint Reviewed-by: Olivier Goffart --- src/corelib/tools/tools.pri | 1 + 1 file changed, 1 insertion(+) (limited to 'src/corelib/tools/tools.pri') 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 += \ tools/qvsnprintf.cpp 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: { -- cgit v1.2.3