[Qtscript-bindings] msvc: qscriptvalue_cast problems

syntheticpp at gmx.net syntheticpp at gmx.net
Wed Jan 7 12:48:22 CET 2009


Building qtscriptgenerator with Qt4.5-beta1 and msvc8/msvc9sp1 SP1 does not work:

 error C2440: 'default argument' : cannot convert from 'T *' to 'QVariant *'

due to this template specialization:

template<typename T>
T qscriptvalue_cast(const QScriptValue &value, T * = 0)
{...}

template <>
inline QVariant qscriptvalue_cast<QVariant>(const QScriptValue &value, QVariant *)
{
    return value.toVariant();
}


A workaround is

diff --git a/qscriptengine.h b/qscriptengine.h
index 205ed9b..0098b68 100644
--- a/qscriptengine.h
+++ b/qscriptengine.h
@@ -359,8 +359,12 @@ inline bool qscriptvalue_cast_helper(const QScriptValue &value, int type, void *
 template<typename T>
 T qscriptvalue_cast(const QScriptValue &value
 #ifndef Q_QDOC
+#ifdef Q_CC_MSVC_NET
+, T * = (T*) 0
+#else
 , T * = 0
 #endif
+#endif
     )
 {
     T t;


Any ideas if this is a compiler bug or just invalid C++?

Peter
-- 
Sensationsangebot verlängert: GMX FreeDSL - Telefonanschluss + DSL 
für nur 16,37 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K1308T4569a


More information about the Qtscript-bindings mailing list