Compile with clang
authorBradley T. Hughes <bradley.hughes@nokia.com>
Thu, 20 Oct 2011 09:18:48 +0000 (11:18 +0200)
committerQt by Nokia <qt-info@nokia.com>
Mon, 24 Oct 2011 13:39:33 +0000 (15:39 +0200)
Clang does not accept this syntax, see
http://llvm.org/bugs/show_bug.cgi?id=8875

The work around is to not use the typedef name. NS() around the
template parameters is necessary to match the real types (and
not the QMetaType::Type enumerators), otherwise we get the following:

kernel/qmetatype.cpp:1647:72: error: template argument for template type
      parameter must be a type
  ...NS(QVariantMap)* >(where)->NS(QVariantMap)::~QMap<QString, ...
                                                       ^~~~~~~

Change-Id: I3afa0cbbe4ef7ad899cfa9eafb3bcc10bedc20b3
Reviewed-by: Wolf-Michael Bolle <wolf-michael.bolle@nokia.com>
Reviewed-by: Thiago Macieira (Intel) <thiago.macieira@intel.com>
src/corelib/kernel/qmetatype.cpp

index 1d22d42..3bf16cd 100644 (file)
@@ -49,6 +49,7 @@
 #include "qvector.h"
 #include "qlocale.h"
 #include "qeasingcurve.h"
+#include "qvariant.h"
 
 #ifdef QT_BOOTSTRAPPED
 # ifndef QT_NO_GEOM_VARIANT
@@ -1643,14 +1644,14 @@ void QMetaType::destruct(int type, void *where)
         break;
 #ifndef QT_BOOTSTRAPPED
     case QMetaType::QVariantMap:
-        static_cast< NS(QVariantMap)* >(where)->NS(QVariantMap)::~QVariantMap();
+        static_cast< NS(QVariantMap)* >(where)->NS(QVariantMap)::~QMap<class QString, class QVariant>();
         break;
     case QMetaType::QVariantHash:
-        static_cast< NS(QVariantHash)* >(where)->NS(QVariantHash)::~QVariantHash();
-        break;
-    case QMetaType::QVariantList:
-        static_cast< NS(QVariantList)* >(where)->NS(QVariantList)::~QVariantList();
+        static_cast< NS(QVariantHash)* >(where)->NS(QVariantHash)::~QHash<class QString, class QVariant>();
         break;
+    case QMetaType::QVariantList: {
+        static_cast< NS(QVariantList)* >(where)->NS(QVariantList)::~QList<class QVariant>();
+        break; }
     case QMetaType::QVariant:
         static_cast< NS(QVariant)* >(where)->NS(QVariant)::~QVariant();
         break;