// { dg-do compile } // { dg-options "-fno-exceptions" } typedef unsigned int uint; struct QShared { bool deref() { return !--count; } uint count; }; template class QValueListNode { public: QValueListNode* next; QValueListNode* prev; }; template class QValueListPrivate : public QShared { public: typedef QValueListNode Node; typedef QValueListNode* NodePtr; QValueListPrivate(); void derefAndDelete() { if ( deref() ) delete this; } ~QValueListPrivate(); NodePtr node; }; template QValueListPrivate::QValueListPrivate() { node = new Node; node->next = node->prev = node; } template QValueListPrivate::~QValueListPrivate() { NodePtr p = node->next; while( p != node ) { NodePtr x = p->next; delete p; p = x; } } template class QValueList { public: QValueList() { sh = new QValueListPrivate; } ~QValueList() { sh->derefAndDelete(); } QValueListPrivate* sh; }; class Cell { QValueList obscuringCells() const; }; QValueList Cell::obscuringCells() const { QValueList empty; }