+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
/* 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;
}
/* 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).
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.
--- /dev/null
+// 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>;