diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-10-14 13:40:55 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-10-14 13:40:55 +0000 |
commit | e10e3320b346319b92e6f0abae07257e6c47afbd (patch) | |
tree | f545cddc5f066d8b80d2a068977307ef0a1f4e64 | |
parent | 5ebf3abab8e91a484cf7a818db79e8ef8321bd25 (diff) | |
download | gcc-e10e3320b346319b92e6f0abae07257e6c47afbd.tar.gz |
2012-10-14 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/52643
* g++.dg/opt/pr52643.C: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192432 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/opt/pr52643.C | 64 |
2 files changed, 69 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 033c8522fa2..3a7dd939a84 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-10-14 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/52643 + * g++.dg/opt/pr52643.C: New. + 2012-10-12 Oleg Endo <olegendo@gcc.gnu.org> PR target/54602 diff --git a/gcc/testsuite/g++.dg/opt/pr52643.C b/gcc/testsuite/g++.dg/opt/pr52643.C new file mode 100644 index 00000000000..271dd76c12d --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr52643.C @@ -0,0 +1,64 @@ +// PR c++/52643 +// { dg-options "-O" } + +template<class T> class already_AddRefd {}; + +template<class T> +class ObjRef +{ +public: + ObjRef() {} + + ObjRef(const already_AddRefd<T> aar) {} + + ~ObjRef() + { + T* mPtr; + mPtr->release_ref(); + } + + operator T* () const + { + return __null; + } + + template<class U> + void operator= (const already_AddRefd<U>& newAssign) {} +}; + +class MyRetClass { +public: + void release_ref(); +}; + +class MyClass +{ + void appendChild(); + void getTripleOutOfByPredicate(); + already_AddRefd<MyRetClass> getNextTriple(); +}; + +void +MyClass::getTripleOutOfByPredicate() +{ + ObjRef<MyRetClass> t (getNextTriple()); + + if (t == __null) + throw MyRetClass(); +} + +void +MyClass::appendChild() +{ + while (1) + { + try + { + ObjRef<MyRetClass> t (getNextTriple()); + continue; + } + catch (MyRetClass) + { + } + } +} |