diff options
Diffstat (limited to 'gcc/d/expr.cc')
-rw-r--r-- | gcc/d/expr.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/d/expr.cc b/gcc/d/expr.cc index 34b3ddd..1bb10a8 100644 --- a/gcc/d/expr.cc +++ b/gcc/d/expr.cc @@ -2917,14 +2917,13 @@ public: void visit (VectorExp *e) final override { - tree type = build_ctype (e->type); - /* First handle array literal expressions. */ if (e->e1->op == EXP::arrayLiteral) { ArrayLiteralExp *ale = e->e1->isArrayLiteralExp (); vec <constructor_elt, va_gc> *elms = NULL; bool constant_p = true; + tree type = build_ctype (e->type); vec_safe_reserve (elms, ale->elements->length); for (size_t i = 0; i < ale->elements->length; i++) @@ -2944,9 +2943,16 @@ public: else this->result_ = build_constructor (type, elms); } + else if (e->e1->type->toBasetype ()->ty == TY::Tsarray) + { + /* Build a vector representation from a static array. */ + this->result_ = convert_expr (build_expr (e->e1, this->constp_), + e->e1->type, e->type); + } else { /* Build constructor from single value. */ + tree type = build_ctype (e->type); tree value = d_convert (TREE_TYPE (type), build_expr (e->e1, this->constp_, true)); this->result_ = build_vector_from_val (type, value); |