re PR c++/17121 (Link problem with function-local classes)

PR c++/17121
	* decl.c (expand_static_init): Use DECL_FUNCTION_SCOPE_P.


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

From-SVN: r86353
This commit is contained in:
Mark Mitchell 2004-08-21 01:31:27 +00:00 committed by Mark Mitchell
parent bcf9a914ff
commit eba6cfb6b5
4 changed files with 24 additions and 1 deletions

View 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

View 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;

View 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.

View File

@ -0,0 +1,10 @@
// PR c++/17121
struct A {
virtual ~A() {}
};
void tsk_tsk()
{
struct B : public A {};
}