Fix class constructor error on assignments to const.

This commit is contained in:
Wilson Snyder 2020-08-22 22:44:00 -04:00
parent 7f3a73e314
commit 4e6d2cfe38
3 changed files with 4 additions and 1 deletions

View File

@ -15,6 +15,8 @@ The contributors that suggested a given feature are shown in []. Thanks!
**** Fix naming of "id : begin" blocks.
**** Fix class constructor error on assignments to const.
* Verilator 4.040 2020-08-15

View File

@ -1793,6 +1793,7 @@ private:
if (nodep->lvalue() && nodep->varp()->direction() == VDirection::CONSTREF) {
nodep->v3error("Assigning to const ref variable: " << nodep->prettyNameQ());
} else if (nodep->lvalue() && nodep->varp()->isConst() && !m_paramsOnly
&& (!m_ftaskp || !m_ftaskp->isConstructor())
&& !VN_IS(m_procedurep, Initial)) {
// Too loose, but need to allow our generated first assignment
// Move this to a property of the AstInitial block

View File

@ -5,7 +5,7 @@
// SPDX-License-Identifier: CC0-1.0
class ClsNoArg;
int imembera;
const int imembera; // Ok for new() to assign to a const
function new();
imembera = 5;
endfunction