]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/8391 (infinite loop in cp/decl2.c(finish_file))
authorMark Mitchell <mark@codesourcery.com>
Sat, 2 Nov 2002 00:57:26 +0000 (00:57 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sat, 2 Nov 2002 00:57:26 +0000 (00:57 +0000)
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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/local1.C [new file with mode: 0644]
gcc/toplev.c

index f7b390f88bbb4bc1250773471a22a72896ed4467..324a0dbc37eea75311d2afa2ad6c8ca12529e076 100644 (file)
@@ -1,3 +1,9 @@
+2002-11-01  Mark Mitchell  <mark@codesourcery.com>
+
+       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  <obrien@FreeBSD.org>
 
        * config/sparc/freebsd.h (CPP_CPU64_DEFAULT_SPEC): Define __arch64__.
index 22fecac0d347d7bf023a9619f136334125b602a6..f4e91604fb7305aa30bf11f643a17d424bbc1c0f 100644 (file)
@@ -1,3 +1,8 @@
+2002-11-01  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/8391
+       * g++.dg/opt/local1.C: New test.
+
 2002-10-30  Mark Mitchell  <mark@codesourcery.com>
 
        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 (file)
index 0000000..9cecaee
--- /dev/null
@@ -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);
+}
index d2732ce0e2de768be1b35d5f3134639869763e45..c40beea2e828deb78f9cf1244379bb3e748fa6a8 100644 (file)
@@ -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)