Rebase.
[official-gcc.git] / gcc / testsuite / g++.dg / torture / pr45580.C
blobc3af4910aeba7e752c58db91842f9bb876da8616
1 // { dg-do compile }
3 namespace std {
4     typedef __SIZE_TYPE__ size_t;
6 inline void* operator new(std::size_t, void* __p) throw() {
7     return __p;
9 class Noncopyable  { };
10 struct CollectorCell { };
11 template<typename T> class PassRefPtr {
12 public:
13     T* releaseRef() const { }
15 template <typename T> class NonNullPassRefPtr {
16 public:
17     template <class U> NonNullPassRefPtr(const PassRefPtr<U>& o)
18         : m_ptr(o.releaseRef()) { }
19     mutable T* m_ptr;
21 struct ClassInfo;
22 class JSValue { };
23 JSValue jsNull();
24 class Structure;
25 class JSGlobalData {
26     static void storeVPtrs();
28 class JSCell : public Noncopyable {
29     friend class JSObject;
30     friend class JSGlobalData;
31     virtual ~JSCell();
33 class JSObject : public JSCell {
34 public:
35     explicit JSObject(NonNullPassRefPtr<Structure>);
36     static PassRefPtr<Structure> createStructure(JSValue prototype) { }
38 class 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;
45 void JSGlobalData::storeVPtrs() {
46     CollectorCell cell;
47     void* storage = &cell;
48     JSCell* jsByteArray = new (storage) JSByteArray(JSByteArray::VPtrStealingHack);
49     jsByteArray->~JSCell();