diff --git a/src/V3AstNodeDType.h b/src/V3AstNodeDType.h index 8542bfa1f..635095644 100644 --- a/src/V3AstNodeDType.h +++ b/src/V3AstNodeDType.h @@ -158,7 +158,7 @@ public: bool widthSized() const VL_MT_SAFE { return !m_widthMin || m_widthMin == m_width; } bool generic() const VL_MT_SAFE { return m_generic; } void generic(bool flag) { m_generic = flag; } - std::pair dimensions(bool includeBasic); + std::pair dimensions(bool includeBasic) const; uint32_t arrayUnpackedElements() const; // 1, or total multiplication of all dimensions static int uniqueNumInc() { return ++s_uniqueNum; } const char* charIQWN() const { diff --git a/src/V3AstNodes.cpp b/src/V3AstNodes.cpp index d046745a4..9b5c9947f 100644 --- a/src/V3AstNodes.cpp +++ b/src/V3AstNodes.cpp @@ -1034,11 +1034,11 @@ uint32_t AstNodeDType::arrayUnpackedElements() const { return entries; } -std::pair AstNodeDType::dimensions(bool includeBasic) { +std::pair AstNodeDType::dimensions(bool includeBasic) const { // How many array dimensions (packed,unpacked) does this Var have? uint32_t packed = 0; uint32_t unpacked = 0; - for (AstNodeDType* dtypep = this; dtypep;) { + for (const AstNodeDType* dtypep = this; dtypep;) { dtypep = dtypep->skipRefp(); // Skip AstRefDType/AstTypedef, or return same node if (const AstNodeArrayDType* const adtypep = VN_CAST(dtypep, NodeArrayDType)) { if (VN_IS(adtypep, PackArrayDType)) {