diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/torture/pr35164-2.C')
-rw-r--r-- | gcc/testsuite/g++.dg/torture/pr35164-2.C | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/torture/pr35164-2.C b/gcc/testsuite/g++.dg/torture/pr35164-2.C new file mode 100644 index 000000000..463cad7f7 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr35164-2.C @@ -0,0 +1,27 @@ +struct __shared_count { + __shared_count() { _M_pi = new int; } + int * _M_pi; +}; +template<typename _Tp> +class __shared_ptr { +public: + __shared_ptr(_Tp* __p); + void reset(int * __p) { + __shared_ptr(__p).swap(*this); + } + void swap(__shared_ptr<_Tp>& __other) { + __other._M_refcount._M_pi = _M_refcount._M_pi; + } + __shared_count _M_refcount; +}; +template<typename _Tp> class shared_ptr : public __shared_ptr<_Tp> {}; +int main() { + for (shared_ptr<int> *iter;;) + { + try { + (iter++)->reset(new int); + } + catch (...) { + } + } +} |