From 15ed2619b28355685f8a0010e10dc4198941df38 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 5 May 2015 22:24:38 -0400 Subject: [PATCH] Fix gdb.cp/anon-struct.cc with -std=c++11. gcc/ * dwarf2out.c (gen_member_die): Don't emit anything for an anonymous class constructor. gcc/cp/ * decl2.c (reset_type_linkage_2): Update the DECL_NAME of a maybe-in-charge constructor. From-SVN: r222839 --- gcc/ChangeLog | 5 +++++ gcc/cp/ChangeLog | 3 +++ gcc/cp/decl2.c | 7 ++++++- gcc/dwarf2out.c | 4 ++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3e67699fb33..fc88220cc83 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-05-05 Jason Merrill + + * dwarf2out.c (gen_member_die): Don't emit anything for an + anonymous class constructor. + 2015-05-05 David Malcolm * auto-profile.c (afdo_find_equiv_class): Fix indentation so diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 04e6a50b190..029c64937a2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2015-05-05 Jason Merrill + * decl2.c (reset_type_linkage_2): Update the DECL_NAME of a + maybe-in-charge constructor. + * decl.c (start_decl): Don't push the plain VAR_DECL for a variable template. diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index b2251d80555..0d478471925 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -2648,7 +2648,12 @@ reset_type_linkage_2 (tree type) if (TREE_CODE (m) == VAR_DECL) reset_decl_linkage (m); for (tree m = TYPE_METHODS (type); m; m = DECL_CHAIN (m)) - reset_decl_linkage (m); + { + reset_decl_linkage (m); + if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (m)) + /* Also update its name, for cxx_dwarf_name. */ + DECL_NAME (m) = TYPE_IDENTIFIER (type); + } binding_table_foreach (CLASSTYPE_NESTED_UTDS (type), bt_reset_linkage_2, NULL); } diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index ddca2a83df4..cb2656c4285 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -19951,6 +19951,10 @@ gen_member_die (tree type, dw_die_ref context_die) /* Don't include clones in the member list. */ if (DECL_ABSTRACT_ORIGIN (member)) continue; + /* Nor constructors for anonymous classes. */ + if (DECL_ARTIFICIAL (member) + && dwarf2_name (member, 0) == NULL) + continue; child = lookup_decl_die (member); if (child) -- 2.30.2