forked from github/verilator
Fix class constructor error on assignments to const.
This commit is contained in:
parent
7f3a73e314
commit
4e6d2cfe38
2
Changes
2
Changes
@ -15,6 +15,8 @@ The contributors that suggested a given feature are shown in []. Thanks!
|
|||||||
|
|
||||||
**** Fix naming of "id : begin" blocks.
|
**** Fix naming of "id : begin" blocks.
|
||||||
|
|
||||||
|
**** Fix class constructor error on assignments to const.
|
||||||
|
|
||||||
|
|
||||||
* Verilator 4.040 2020-08-15
|
* Verilator 4.040 2020-08-15
|
||||||
|
|
||||||
|
@ -1793,6 +1793,7 @@ private:
|
|||||||
if (nodep->lvalue() && nodep->varp()->direction() == VDirection::CONSTREF) {
|
if (nodep->lvalue() && nodep->varp()->direction() == VDirection::CONSTREF) {
|
||||||
nodep->v3error("Assigning to const ref variable: " << nodep->prettyNameQ());
|
nodep->v3error("Assigning to const ref variable: " << nodep->prettyNameQ());
|
||||||
} else if (nodep->lvalue() && nodep->varp()->isConst() && !m_paramsOnly
|
} else if (nodep->lvalue() && nodep->varp()->isConst() && !m_paramsOnly
|
||||||
|
&& (!m_ftaskp || !m_ftaskp->isConstructor())
|
||||||
&& !VN_IS(m_procedurep, Initial)) {
|
&& !VN_IS(m_procedurep, Initial)) {
|
||||||
// Too loose, but need to allow our generated first assignment
|
// Too loose, but need to allow our generated first assignment
|
||||||
// Move this to a property of the AstInitial block
|
// Move this to a property of the AstInitial block
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
// SPDX-License-Identifier: CC0-1.0
|
// SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
class ClsNoArg;
|
class ClsNoArg;
|
||||||
int imembera;
|
const int imembera; // Ok for new() to assign to a const
|
||||||
function new();
|
function new();
|
||||||
imembera = 5;
|
imembera = 5;
|
||||||
endfunction
|
endfunction
|
||||||
|
Loading…
Reference in New Issue
Block a user