C++ PATCH: PR 17121
Mark Mitchell
mark@codesourcery.com
Sat Aug 21 03:25:00 GMT 2004
This patch fixes a regression on the mainline caused by my recent
conversion of the C++ front end to always work in unit-at-a-time mode.
Tested on i686-pc-linux-gnu, applied on the mainline.
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
2004-08-20 Mark Mitchell <mark@codesourcery.com>
PR c++/17121
* decl.c (expand_static_init): Use DECL_FUNCTION_SCOPE_P.
2004-08-20 Mark Mitchell <mark@codesourcery.com>
PR c++/17121
* g++.dg/inherit/local2.C: New test.
Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.1274
diff -c -5 -p -r1.1274 decl.c
*** cp/decl.c 19 Aug 2004 10:36:04 -0000 1.1274
--- cp/decl.c 21 Aug 2004 01:28:10 -0000
*************** expand_static_init (tree decl, tree init
*** 5149,5159 ****
if (!init
&& !TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl))
&& TYPE_HAS_TRIVIAL_DESTRUCTOR (TREE_TYPE (decl)))
return;
! if (! toplevel_bindings_p ())
{
/* Emit code to perform this initialization but once. */
tree if_stmt;
tree then_clause;
tree assignment;
--- 5149,5159 ----
if (!init
&& !TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl))
&& TYPE_HAS_TRIVIAL_DESTRUCTOR (TREE_TYPE (decl)))
return;
! if (DECL_FUNCTION_SCOPE_P (decl))
{
/* Emit code to perform this initialization but once. */
tree if_stmt;
tree then_clause;
tree assignment;
Index: testsuite/g++.dg/inherit/local1.C
===================================================================
RCS file: testsuite/g++.dg/inherit/local1.C
diff -N testsuite/g++.dg/inherit/local1.C
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/inherit/local1.C 21 Aug 2004 01:28:11 -0000
***************
*** 0 ****
--- 1,10 ----
+ // PR c++/17121
+
+ struct A {
+ virtual ~A() {}
+ };
+
+ void tsk_tsk()
+ {
+ struct B : public A {};
+ }
More information about the Gcc-patches
mailing list