1 // { dg-do assemble { target fpic } }
2 // { dg-options "-O2 -fweb -fPIC -fvisibility=hidden -Wno-return-type" }
3 // { dg-require-visibility "" }
4
5 class QBasicAtomicInt
6 {
7 public:
8 volatile int _q_value;
9 inline operator int () const {return _q_value;}
10 };
11 class QVariant;
12 class QScriptContext;
13 class QScriptEngine;
14 class QScriptValue
15 {
16 public:
17 QVariant toVariant () const;
18 };
19 class QScriptDebuggerBackendPrivate
20 {
21 static QScriptValue trace (QScriptContext *context);
22 };
23 template <typename T> struct QMetaTypeId { };
24 template <typename T> struct QMetaTypeId2
25 {
qt_metatype_idQMetaTypeId226 static inline int qt_metatype_id ()
27 {
28 return QMetaTypeId<T>::qt_metatype_id () ;
29 }
30 };
31 template <typename T> inline int qMetaTypeId (T * = 0)
32 {
33 return QMetaTypeId2<T>::qt_metatype_id () ;
34 }
35 class QVariant { };
qvariant_cast(const QVariant & v)36 template<typename T> inline T qvariant_cast (const QVariant &v)
37 {
38 const int vid = qMetaTypeId<T> ((0)) ;
39 return T();
40 };
41 class QScriptContext
42 {
43 public:
44 QScriptValue callee () const;
45 };
46 class QScriptEngine
47 {
48 public:
49 static bool convertV2 (const QScriptValue &value , int type , void *ptr) ;
50 };
qscriptvalue_cast_helper(const QScriptValue & value,int type,void * ptr)51 inline bool qscriptvalue_cast_helper (const QScriptValue &value , int type , void *ptr)
52 {
53 return QScriptEngine::convertV2 (value, type, ptr) ;
54 }
qscriptvalue_cast(const QScriptValue & value)55 template<typename T> T qscriptvalue_cast (const QScriptValue &value)
56 {
57 T t;
58 const int id = qMetaTypeId<T> () ;
59 if ( qscriptvalue_cast_helper (value, id, &t))
60 return qvariant_cast<T> (value.toVariant ()) ;
61 }
62 template <> struct QMetaTypeId< QScriptDebuggerBackendPrivate* >
63 {
64 static int qt_metatype_id ()
65 {
66 static QBasicAtomicInt metatype_id = { (0) };
67 return metatype_id;
68 }
69 };
70 QScriptValue QScriptDebuggerBackendPrivate::trace (QScriptContext *context)
71 {
72 QScriptValue data = context->callee () ;
73 QScriptDebuggerBackendPrivate *self = qscriptvalue_cast<QScriptDebuggerBackendPrivate*> (data) ;
74 return QScriptValue();
75 }
76