From: Paolo Carlini Date: Sun, 14 Oct 2012 13:40:55 +0000 (+0000) Subject: re PR c++/52643 (Stack overflow ICE in cc1plus when templates, exceptions, and contin... X-Git-Tag: misc/gccgo-go1_1_2~181 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ca6729e2ed7b8a1308fdfdec0edcb6e9240f3258;p=thirdparty%2Fgcc.git re PR c++/52643 (Stack overflow ICE in cc1plus when templates, exceptions, and continue out of try used) 2012-10-14 Paolo Carlini PR c++/52643 * g++.dg/opt/pr52643.C: New. From-SVN: r192432 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 033c8522fa23..3a7dd939a844 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-10-14 Paolo Carlini + + PR c++/52643 + * g++.dg/opt/pr52643.C: New. + 2012-10-12 Oleg Endo 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 000000000000..271dd76c12d3 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr52643.C @@ -0,0 +1,64 @@ +// PR c++/52643 +// { dg-options "-O" } + +template class already_AddRefd {}; + +template +class ObjRef +{ +public: + ObjRef() {} + + ObjRef(const already_AddRefd aar) {} + + ~ObjRef() + { + T* mPtr; + mPtr->release_ref(); + } + + operator T* () const + { + return __null; + } + + template + void operator= (const already_AddRefd& newAssign) {} +}; + +class MyRetClass { +public: + void release_ref(); +}; + +class MyClass +{ + void appendChild(); + void getTripleOutOfByPredicate(); + already_AddRefd getNextTriple(); +}; + +void +MyClass::getTripleOutOfByPredicate() +{ + ObjRef t (getNextTriple()); + + if (t == __null) + throw MyRetClass(); +} + +void +MyClass::appendChild() +{ + while (1) + { + try + { + ObjRef t (getNextTriple()); + continue; + } + catch (MyRetClass) + { + } + } +}