Work around MSVC ABI stupidity in exporting inline members of base class

In this case, the issue was ICC, when compiling QtQml:

qv4sequenceobject.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl QList<class QItemSelectionRange>::replace(int,class QItemSelectionRange const &)" (__imp_?replace@?$QList@VQItemSelectionRange@@@@QEAAXHAEBVQItemSelectionRange@@@Z)
  referenced in function "public: static bool __cdecl QV4::QQmlSequence<class QItemSelection>::deleteIndexedProperty(struct QV4::Managed *,unsigned int)" (?deleteIndexedProperty@?$QQmlSequence@VQItemSelection@@@QV4@@SA_NPEAUManaged@2@I@Z)

This applies the same fix as qvector.h has had for ages due to QPolygon.

Change-Id: I15b62e0f9cec482fbb40fffd1490d791db5056bc
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
bb10
Thiago Macieira 2016-12-16 12:48:18 -08:00 committed by Jani Heikkinen
parent f55db6738b
commit 39e80062d0
2 changed files with 20 additions and 0 deletions

View File

@ -251,6 +251,24 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QItemSelectionModel::SelectionFlags)
// dummy implentation of qHash() necessary for instantiating QList<QItemSelectionRange>::toSet() with MSVC
inline uint qHash(const QItemSelectionRange &) { return 0; }
#ifdef Q_CC_MSVC
/*
### Qt 6:
### This needs to be removed for next releases of Qt. It is a workaround for vc++ because
### Qt exports QItemSelection that inherits QList<QItemSelectionRange>.
*/
# ifndef Q_TEMPLATE_EXTERN
# if defined(QT_BUILD_CORE_LIB)
# define Q_TEMPLATE_EXTERN
# else
# define Q_TEMPLATE_EXTERN extern
# endif
# endif
Q_TEMPLATE_EXTERN template class Q_CORE_EXPORT QList<QItemSelectionRange>;
#endif // Q_CC_MSVC
class Q_CORE_EXPORT QItemSelection : public QList<QItemSelectionRange>
{
public:

View File

@ -982,11 +982,13 @@ QT_BEGIN_INCLUDE_NAMESPACE
#include <QtCore/qpoint.h>
QT_END_INCLUDE_NAMESPACE
#ifndef Q_TEMPLATE_EXTERN
#if defined(QT_BUILD_CORE_LIB)
#define Q_TEMPLATE_EXTERN
#else
#define Q_TEMPLATE_EXTERN extern
#endif
#endif
Q_TEMPLATE_EXTERN template class Q_CORE_EXPORT QVector<QPointF>;
Q_TEMPLATE_EXTERN template class Q_CORE_EXPORT QVector<QPoint>;
#endif