Fix std::randomize inside {typedef array} internal error (#7481)

Fixes #7481.
This commit is contained in:
Yilou Wang
2026-04-23 11:16:24 -04:00
committed by GitHub
parent ae642facf5
commit 27e7fdc9eb
3 changed files with 96 additions and 1 deletions
+3 -1
View File
@@ -964,7 +964,9 @@ class ConstraintExprVisitor final : public VNVisitor {
AstNodeExpr* newSel(FileLine* fl, AstNodeExpr* arrayp, AstNodeExpr* idxp) {
// similar to V3WidthSel.cpp
AstNodeDType* const arrDtp = arrayp->unlinkFrBack()->dtypep();
// skipRefp() unwraps typedef wrappers (AstRefDType) so the dtype kind
// checks below recognize types spelled as `typedef <scalar> <name>[$]`.
AstNodeDType* const arrDtp = arrayp->unlinkFrBack()->dtypep()->skipRefp();
AstNodeExpr* selp = nullptr;
if (VN_IS(arrDtp, QueueDType) || VN_IS(arrDtp, DynArrayDType))
selp = new AstCMethodHard{fl, arrayp, VCMethod::ARRAY_AT, idxp};