PR c++/17121
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 21 Aug 2004 01:31:27 +0000 (01:31 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 21 Aug 2004 01:31:27 +0000 (01:31 +0000)
* decl.c (expand_static_init): Use DECL_FUNCTION_SCOPE_P.

PR c++/17121
* g++.dg/inherit/local2.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@86353 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/inherit/local1.C [new file with mode: 0644]

index 2b794f0..c0f488e 100644 (file)
@@ -1,3 +1,8 @@
+2004-08-20  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/17121
+       * decl.c (expand_static_init): Use DECL_FUNCTION_SCOPE_P.
+
 2004-08-21  Joseph S. Myers  <jsm@polyomino.org.uk>
 
        PR c++/17120
index 36e83d9..d9a7449 100644 (file)
@@ -5151,7 +5151,7 @@ expand_static_init (tree decl, tree init)
       && TYPE_HAS_TRIVIAL_DESTRUCTOR (TREE_TYPE (decl)))
     return;
 
-  if (! toplevel_bindings_p ())
+  if (DECL_FUNCTION_SCOPE_P (decl))
     {
       /* Emit code to perform this initialization but once.  */
       tree if_stmt;
index d096a1b..2475629 100644 (file)
@@ -1,3 +1,8 @@
+2004-08-20  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/17121
+       * g++.dg/inherit/local2.C: New test.
+
 2004-08-21  Joseph S. Myers  <jsm@polyomino.org.uk>
 
        PR c++/17120
@@ -5,6 +10,9 @@
 
 2004-08-20  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/17121
+       * g++.dg/inherit/local2.C: New test.
+
        * gcc.dg/darwin-longlong.c: Include <stdlib.h>.
        * gcc.dg/ppc-ldstruct.c: Likewise.
        * gcc.dg/ppc64-abi-2.c: Likewise.
diff --git a/gcc/testsuite/g++.dg/inherit/local1.C b/gcc/testsuite/g++.dg/inherit/local1.C
new file mode 100644 (file)
index 0000000..3cb196c
--- /dev/null
@@ -0,0 +1,10 @@
+// PR c++/17121
+
+struct A {
+  virtual ~A() {}
+};
+
+void tsk_tsk()
+{
+  struct B : public A {};
+}