summaryrefslogtreecommitdiff
path: root/gcc/cp/tree.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2021-04-15 17:04:24 -0400
committerJason Merrill <jason@redhat.com>2021-04-29 14:33:39 -0400
commit3f0de4dd51fd9a1e9628411b4fd728f5841256fe (patch)
treeaf3e957d72b4b8b8005c81047b611418db51cc84 /gcc/cp/tree.c
parentefeca0ac4155b76ce713155f190422aac20537c5 (diff)
downloadgcc-3f0de4dd51fd9a1e9628411b4fd728f5841256fe.tar.gz
c++: unset COMPOUND_LITERAL_P [PR100079]
Once a CONSTRUCTOR has been digested and used as an initializer, it no longer represents a compound literal by itself, so we can clear the flag, letting us use it consistently to distinguish between digested and undigested initializer-lists. gcc/cp/ChangeLog: * cp-tree.h: Clarify comments. * pt.c (get_template_parm_object): Add assert. * semantics.c (finish_compound_literal): Clear TREE_HAS_CONSTRUCTOR. * tree.c (zero_init_expr_p): Check TREE_HAS_CONSTRUCTOR. * typeck2.c (store_init_value): Likewise.
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r--gcc/cp/tree.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index a8bfd5fc053..3a20cd33fdc 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -4684,13 +4684,9 @@ zero_init_expr_p (tree t)
return null_member_pointer_value_p (t);
if (TREE_CODE (t) == CONSTRUCTOR)
{
- if (CONSTRUCTOR_IS_DEPENDENT (t)
+ if (COMPOUND_LITERAL_P (t)
|| BRACE_ENCLOSED_INITIALIZER_P (t))
- /* Undigested, conversions might change the zeroness.
-
- Other COMPOUND_LITERAL_P in template context are also undigested,
- but there isn't currently a way to distinguish between them and
- COMPOUND_LITERAL_P from non-template context that are digested. */
+ /* Undigested, conversions might change the zeroness. */
return false;
for (constructor_elt &elt : CONSTRUCTOR_ELTS (t))
{