111
|
1 // { dg-do compile }
|
131
|
2 // { dg-additional-options "-Wno-return-type" }
|
111
|
3
|
|
4 namespace std {
|
|
5 typedef __SIZE_TYPE__ size_t;
|
|
6 }
|
|
7 inline void* operator new(std::size_t, void* __p) throw() {
|
|
8 return __p;
|
|
9 }
|
|
10 class Noncopyable { };
|
|
11 struct CollectorCell { };
|
|
12 template<typename T> class PassRefPtr {
|
|
13 public:
|
|
14 T* releaseRef() const { }
|
|
15 };
|
|
16 template <typename T> class NonNullPassRefPtr {
|
|
17 public:
|
|
18 template <class U> NonNullPassRefPtr(const PassRefPtr<U>& o)
|
|
19 : m_ptr(o.releaseRef()) { }
|
|
20 mutable T* m_ptr;
|
|
21 };
|
|
22 struct ClassInfo;
|
|
23 class JSValue { };
|
|
24 JSValue jsNull();
|
|
25 class Structure;
|
|
26 class JSGlobalData {
|
|
27 static void storeVPtrs();
|
|
28 };
|
|
29 class JSCell : public Noncopyable {
|
|
30 friend class JSObject;
|
|
31 friend class JSGlobalData;
|
|
32 virtual ~JSCell();
|
|
33 };
|
|
34 class JSObject : public JSCell {
|
|
35 public:
|
|
36 explicit JSObject(NonNullPassRefPtr<Structure>);
|
|
37 static PassRefPtr<Structure> createStructure(JSValue prototype) { }
|
|
38 };
|
|
39 class JSByteArray : public JSObject {
|
|
40 friend class JSGlobalData;
|
|
41 enum VPtrStealingHackType { VPtrStealingHack };
|
|
42 JSByteArray(VPtrStealingHackType)
|
|
43 : JSObject(createStructure(jsNull())), m_classInfo(0) { }
|
|
44 const ClassInfo* m_classInfo;
|
|
45 };
|
|
46 void JSGlobalData::storeVPtrs() {
|
|
47 CollectorCell cell;
|
|
48 void* storage = &cell;
|
|
49 JSCell* jsByteArray = new (storage) JSByteArray(JSByteArray::VPtrStealingHack);
|
|
50 jsByteArray->~JSCell();
|
|
51 }
|