gcc/testsuite/g++.old-deja/g++.jason/dtor3.C
raw| 1 | // { dg-do assemble } |
| 2 | // PRMS Id: 5341 |
| 3 | // Bug: g++ complains about the explicit destructor notation. |
| 4 | |
| 5 | #include <stddef.h> |
| 6 | |
| 7 | void *operator new(size_t Size, void* pThing) { return pThing; } |
| 8 | |
| 9 | template <class T> class Stack { |
| 10 | public: |
| 11 | Stack() { new (Data) T(); } |
| 12 | ~Stack() { ((T*)Data)->~T(); } |
| 13 | private: |
| 14 | char Data[sizeof(T)]; |
| 15 | }; |
| 16 | |
| 17 | Stack<int> a; |
| 18 | Stack<Stack<int> > c; |