re PR c++/47303 (ICE: in varpool_node, at varpool.c:134 with -fabi-version=1)

PR c++/47303
	* decl2.c (finish_anon_union): Only call mangle_decl if TREE_STATIC
	or DECL_EXTERNAL.

	* g++.dg/template/anonunion1.C: New test.

From-SVN: r169000
This commit is contained in:
Jakub Jelinek 2011-01-19 16:36:57 +01:00 committed by Jakub Jelinek
parent b899fd784b
commit cfea9968d1
5 changed files with 36 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2011-01-19 Jakub Jelinek <jakub@redhat.com>
PR c++/47303
* decl2.c (finish_anon_union): Only call mangle_decl if TREE_STATIC
or DECL_EXTERNAL.
2011-01-17 Jason Merrill <jason@redhat.com>
PR c++/47067

View File

@ -1409,7 +1409,8 @@ finish_anon_union (tree anon_union_decl)
/* Use main_decl to set the mangled name. */
DECL_NAME (anon_union_decl) = DECL_NAME (main_decl);
maybe_commonize_var (anon_union_decl);
mangle_decl (anon_union_decl);
if (TREE_STATIC (anon_union_decl) || DECL_EXTERNAL (anon_union_decl))
mangle_decl (anon_union_decl);
DECL_NAME (anon_union_decl) = NULL_TREE;
}

View File

@ -1,6 +1,6 @@
/* Handle parameterized types (templates) for GNU C++.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
Written by Ken Raeburn (raeburn@cygnus.com) while at Watchmaker Computing.
Rewritten by Jason Merrill (jason@cygnus.com).

View File

@ -1,5 +1,8 @@
2011-01-19 Jakub Jelinek <jakub@redhat.com>
PR c++/47303
* g++.dg/template/anonunion1.C: New test.
PR rtl-optimization/47337
* gcc.c-torture/execute/pr47337.c: New test.

View File

@ -0,0 +1,24 @@
// PR c++/47303
// { dg-do compile }
// { dg-options "-fabi-version=1" }
struct Z
{
void foo (int);
};
struct F
{
typedef void (Z::*zm) (int);
typedef void (F::*fm) (int);
template <zm>
void bar (int)
{
union
{
Z z;
};
}
};
F::fm m = &F::bar <&Z::foo>;