decl.c (pushdecl): Don't copy types if the DECL_ABSTRACT_ORIGIN of the new decl matches the...

* decl.c (pushdecl): Don't copy types if the
	DECL_ABSTRACT_ORIGIN of the new decl matches the TYPE_NAME of the
	type.

From-SVN: r22381
This commit is contained in:
Mark Mitchell 1998-09-10 11:20:43 +00:00 committed by Mark Mitchell
parent 02e24c7ab0
commit 1c80fb65ce
3 changed files with 26 additions and 1 deletions

View file

@ -1,3 +1,9 @@
1998-09-10 Mark Mitchell <mark@markmitchell.com>
* decl.c (pushdecl): Don't copy types if the
DECL_ABSTRACT_ORIGIN of the new decl matches the TYPE_NAME of the
type.
1998-09-09 Kriang Lerdsuwanakij <lerdsuwa@scf-fs.usc.edu>
* class.c (get_enclosing_class): New function.

View file

@ -3479,7 +3479,12 @@ pushdecl (x)
if (TYPE_NAME (type) == 0)
TYPE_NAME (type) = x;
}
else if (type != error_mark_node && TYPE_NAME (type) != x)
else if (type != error_mark_node && TYPE_NAME (type) != x
/* We don't want to copy the type when all we're
doing is making a TYPE_DECL for the purposes of
inlining. */
&& (!TYPE_NAME (type)
|| TYPE_NAME (type) != DECL_ABSTRACT_ORIGIN (x)))
{
push_obstacks (TYPE_OBSTACK (type), TYPE_OBSTACK (type));

View file

@ -0,0 +1,14 @@
// Build don't link:
// Special g++ Options: -g -O2
inline void f() {
struct S {};
S s;
}
int g()
{
for (int i = 0; i < 2; ++i)
f();
}