aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2022-04-06 20:04:21 -0400
committerJason Merrill <jason@redhat.com>2022-04-06 21:27:27 -0400
commitd9421784980276b42ecdce85b6dde28e965c88c6 (patch)
treeb039ced4f783f9a5a1ded4437c142f318025c29e
parent80eb8ec67277b83fdeec01427cf1609f1f679fed (diff)
downloadgcc-d9421784980276b42ecdce85b6dde28e965c88c6.zip
gcc-d9421784980276b42ecdce85b6dde28e965c88c6.tar.gz
gcc-d9421784980276b42ecdce85b6dde28e965c88c6.tar.bz2
c++: vector compound literal [PR105187]
My cleanup in r12-296 cleared TREE_HAS_CONSTRUCTOR on digested class initializers, but we leave it set for vectors, since we can't wrap them in TARGET_EXPR. PR c++/105187 gcc/cp/ChangeLog: * typeck2.cc (store_init_value): Allow TREE_HAS_CONSTRUCTOR for vectors. gcc/testsuite/ChangeLog: * gcc.c-torture/compile/20050113-1.c: Moved to... * c-c++-common/torture/20050113-1.c: ...here.
-rw-r--r--gcc/cp/typeck2.cc1
-rw-r--r--gcc/testsuite/c-c++-common/torture/20050113-1.c (renamed from gcc/testsuite/gcc.c-torture/compile/20050113-1.c)0
2 files changed, 1 insertions, 0 deletions
diff --git a/gcc/cp/typeck2.cc b/gcc/cp/typeck2.cc
index cebe6ac..23ed81e 100644
--- a/gcc/cp/typeck2.cc
+++ b/gcc/cp/typeck2.cc
@@ -922,6 +922,7 @@ store_init_value (tree decl, tree init, vec<tree, va_gc>** cleanups, int flags)
here it should have been digested into an actual value for the type. */
gcc_checking_assert (TREE_CODE (value) != CONSTRUCTOR
|| processing_template_decl
+ || TREE_CODE (type) == VECTOR_TYPE
|| !TREE_HAS_CONSTRUCTOR (value));
/* If the initializer is not a constant, fill in DECL_INITIAL with
diff --git a/gcc/testsuite/gcc.c-torture/compile/20050113-1.c b/gcc/testsuite/c-c++-common/torture/20050113-1.c
index 6e36ed6..6e36ed6 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20050113-1.c
+++ b/gcc/testsuite/c-c++-common/torture/20050113-1.c