From d6337a5bc5ff46fc0712a0aac1426034d79a771c Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Thu, 17 Mar 2022 10:31:33 +0100 Subject: [PATCH] parray_type_t: Check if base type is packed after elaboration Packed arrays are only allowed of packed base types. Currently whether the base type is packed is checked before elaborating the base type. This works as long as the actual type is known before elaboration. But for example with type parameters the actual type is only known after elaboration. In order to be able to support type parameters move the check for whether the type is packed after elaboration. Signed-off-by: Lars-Peter Clausen --- elab_type.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elab_type.cc b/elab_type.cc index 413e6f61c..48dd1dcbd 100644 --- a/elab_type.cc +++ b/elab_type.cc @@ -168,7 +168,8 @@ ivl_type_t parray_type_t::elaborate_type_raw(Design*des, NetScope*scope) const if (dims.get()) evaluate_ranges(des, scope, this, packed, *dims); - if (base_type->figure_packed_base_type() == IVL_VT_NO_TYPE) { + ivl_type_t etype = base_type->elaborate_type(des, scope); + if (!etype->packed()) { cerr << this->get_fileline() << " error: Packed array "; if (!name.nil()) cerr << "`" << name << "` "; @@ -180,7 +181,6 @@ ivl_type_t parray_type_t::elaborate_type_raw(Design*des, NetScope*scope) const cerr << "` is not packed." << endl; des->errors++; } - ivl_type_t etype = base_type->elaborate_type(des, scope); return new netparray_t(packed, etype); }