mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 10:03:44 +02:00
Fix crash on empty '#()' parameter list on class instance (#8182)
The following used to crash:
```systemverilog
class base #(type T = int); endclass
class derived extends base; endclass
derived #() d; // <- crash due to '#()'
```
This commit is contained in:
+4
-2
@@ -1886,8 +1886,10 @@ class ParamProcessor final {
|
||||
std::vector<AstPin*> pinsByIndex;
|
||||
pinsByIndex.resize(m_classTypeParams.size(), nullptr);
|
||||
for (AstPin* pinp = paramsp; pinp; pinp = VN_AS(pinp->nextp(), Pin)) {
|
||||
if (AstParamTypeDType* typep = pinp->modPTypep()) {
|
||||
pinsByIndex[m_paramIndex[typep]] = pinp;
|
||||
AstParamTypeDType* const typep = pinp->modPTypep();
|
||||
const auto it = typep ? m_paramIndex.find(typep) : m_paramIndex.end();
|
||||
if (it != m_paramIndex.end()) {
|
||||
pinsByIndex[it->second] = pinp;
|
||||
} else {
|
||||
pinsByIndex.push_back(pinp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user