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