aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/init.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-06-11 15:01:40 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2019-06-11 15:01:40 +0200
commit5a5da48013f29c55bd9a4221ebc72104b80e4982 (patch)
tree2bc3d382017ed835296e5947bcc18fc10ff41a26 /gcc/cp/init.c
parent7ac9a201848f020a7803c5b3e20dc4768a992c40 (diff)
downloadgcc-5a5da48013f29c55bd9a4221ebc72104b80e4982.zip
gcc-5a5da48013f29c55bd9a4221ebc72104b80e4982.tar.gz
gcc-5a5da48013f29c55bd9a4221ebc72104b80e4982.tar.bz2
re PR c++/90810 (Different intrinsics behavior on G++ 7.4 and G++ 8.3)
PR c++/90810 * init.c (constant_value_1): Handle VECTOR_CST DECL_INITIAL for !DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P decls like CONSTRUCTOR. * g++.dg/ext/vector37.C: New test. From-SVN: r272152
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r--gcc/cp/init.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index b206263..e962113 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -2339,8 +2339,11 @@ constant_value_1 (tree decl, bool strict_p, bool return_aggregate_cst_ok_p)
|| TREE_CODE (init) == STRING_CST)))
break;
/* Don't return a CONSTRUCTOR for a variable with partial run-time
- initialization, since it doesn't represent the entire value. */
- if (TREE_CODE (init) == CONSTRUCTOR
+ initialization, since it doesn't represent the entire value.
+ Similarly for VECTOR_CSTs created by cp_folding those
+ CONSTRUCTORs. */
+ if ((TREE_CODE (init) == CONSTRUCTOR
+ || TREE_CODE (init) == VECTOR_CST)
&& !DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl))
break;
/* If the variable has a dynamic initializer, don't use its