aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/tree.cc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2022-01-22 17:11:54 -0500
committerJason Merrill <jason@redhat.com>2022-01-22 22:18:42 -0500
commit9718bc4b03c1a94f7cf64860bbc828aa53c56234 (patch)
treeafb8867506fec1386ffb86456536924737a562b0 /gcc/cp/tree.cc
parent053bcc97f4a59e3f2811b8a1edf60fd733a580a0 (diff)
downloadgcc-9718bc4b03c1a94f7cf64860bbc828aa53c56234.zip
gcc-9718bc4b03c1a94f7cf64860bbc828aa53c56234.tar.gz
gcc-9718bc4b03c1a94f7cf64860bbc828aa53c56234.tar.bz2
c++: array temporary at file scope [PR104182]
This is the same issue as PR104031, but that patch doesn't fix this testcase because in this case, current_function_decl isn't set when we get to cp_genericize_target_expr. But there seems to be no need for is_local_temp to check for function scope; !TREE_STATIC should be enough. PR c++/104182 gcc/cp/ChangeLog: * cp-gimplify.cc (cp_genericize_target_expr): Make sure nothing has set DECL_INITIAL on a TARGET_EXPR slot. * tree.cc (is_local_temp): Don't check DECL_CONTEXT. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/initlist127.C: New test.
Diffstat (limited to 'gcc/cp/tree.cc')
-rw-r--r--gcc/cp/tree.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc
index f88006a..5d453e4 100644
--- a/gcc/cp/tree.cc
+++ b/gcc/cp/tree.cc
@@ -557,8 +557,7 @@ bool
is_local_temp (tree decl)
{
return (VAR_P (decl) && DECL_ARTIFICIAL (decl)
- && !TREE_STATIC (decl)
- && DECL_FUNCTION_SCOPE_P (decl));
+ && !TREE_STATIC (decl));
}
/* Set various status flags when building an AGGR_INIT_EXPR object T. */