aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2020-07-22 08:38:58 -0700
committerNathan Sidwell <nathan@acm.org>2020-07-22 08:43:26 -0700
commit6e1e0decc9e17a4283d1b5508e892be5215b8ab9 (patch)
tree2e32971813a1d65d01c41b8ef8824da11457627a
parent7be9b276b441dd8b33283c2bc36906e94b569806 (diff)
downloadgcc-6e1e0decc9e17a4283d1b5508e892be5215b8ab9.zip
gcc-6e1e0decc9e17a4283d1b5508e892be5215b8ab9.tar.gz
gcc-6e1e0decc9e17a4283d1b5508e892be5215b8ab9.tar.bz2
c++: Don't add enums to class's decl_list
We don't need to add CONST_DECLs to a template decl's decl list. Also made the code flow a bit clearer. gcc/cp/ * class.c (maybe_add_class_template_decl_list): Don't add CONST_DECLs.
-rw-r--r--gcc/cp/class.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 803b33b..a3913f4 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -3049,11 +3049,14 @@ finish_struct_anon (tree t)
void
maybe_add_class_template_decl_list (tree type, tree t, int friend_p)
{
- /* Save some memory by not creating TREE_LIST if TYPE is not template. */
- if (CLASSTYPE_TEMPLATE_INFO (type))
- CLASSTYPE_DECL_LIST (type)
- = tree_cons (friend_p ? NULL_TREE : type,
- t, CLASSTYPE_DECL_LIST (type));
+ if (CLASSTYPE_TEMPLATE_INFO (type)
+ && TREE_CODE (t) != CONST_DECL)
+ {
+ tree purpose = friend_p ? NULL_TREE : type;
+
+ CLASSTYPE_DECL_LIST (type)
+ = tree_cons (purpose, t, CLASSTYPE_DECL_LIST (type));
+ }
}
/* This function is called from declare_virt_assop_and_dtor via