From: Mark Mitchell Date: Sat, 2 Nov 2002 00:57:26 +0000 (+0000) Subject: re PR c++/8391 (infinite loop in cp/decl2.c(finish_file)) X-Git-Tag: releases/gcc-3.2.1~70 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5cee832e4b3cac3d65f70a50b1c4a1fb2f44a52;p=thirdparty%2Fgcc.git re PR c++/8391 (infinite loop in cp/decl2.c(finish_file)) PR c++/8391 * toplev.c (rest_of_compilation): Do not refuse to output code for an inline function in a local class. PR c++/8391 * g++.dg/opt/local1.C: New test. From-SVN: r58733 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f7b390f88bbb..324a0dbc37ee 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2002-11-01 Mark Mitchell + + PR c++/8391 + * toplev.c (rest_of_compilation): Do not refuse to output code for + an inline function in a local class. + 2002-11-01 David O'Brien * config/sparc/freebsd.h (CPP_CPU64_DEFAULT_SPEC): Define __arch64__. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 22fecac0d347..f4e91604fb73 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2002-11-01 Mark Mitchell + + PR c++/8391 + * g++.dg/opt/local1.C: New test. + 2002-10-30 Mark Mitchell PR c++/8160 diff --git a/gcc/testsuite/g++.dg/opt/local1.C b/gcc/testsuite/g++.dg/opt/local1.C new file mode 100644 index 000000000000..9cecaee6f2ad --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/local1.C @@ -0,0 +1,20 @@ +// { dg-options "-O" } + +struct Outer { + struct Inner { virtual bool f() = 0; }; + void g(Inner &) const; +}; + +inline void h(const Outer &o) +{ + struct Local : public Outer::Inner { + virtual bool f() {}; + }; + Local l; + o.g(l); +} + +void f(Outer &req) { + h (req); +} + diff --git a/gcc/toplev.c b/gcc/toplev.c index d2732ce0e2de..c40beea2e828 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -2411,6 +2411,9 @@ rest_of_compilation (decl) DECL_INITIAL (decl) = 0; goto exit_rest_of_compilation; } + else if (TYPE_P (parent)) + /* A function in a local class should be treated normally. */ + break; /* If requested, consider whether to make this function inline. */ if ((DECL_INLINE (decl) && !flag_no_inline)