summaryrefslogtreecommitdiff
path: root/gcc/cp/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r--gcc/cp/init.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 869b89245f9..406cec6af7a 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -3639,7 +3639,9 @@ build_vec_init (tree base, tree maxindex, tree init,
if (TREE_CODE (type) == ARRAY_TYPE)
m = cp_build_binary_op (input_location,
MULT_EXPR, m,
- array_type_nelts_total (type),
+ /* Avoid mixing signed and unsigned. */
+ convert (TREE_TYPE (m),
+ array_type_nelts_total (type)),
complain);
finish_cleanup_try_block (try_block);