Fix return in constructors (#3734)

This commit is contained in:
Ryszard Rozak
2022-11-09 06:32:22 -05:00
committed by GitHub
parent a29d9469da
commit cbf9cc8e5f
3 changed files with 57 additions and 1 deletions
+1 -1
View File
@@ -234,7 +234,7 @@ private:
return;
} else if (!m_ftaskp) {
nodep->v3error("Return isn't underneath a task or function");
} else if (funcp && !nodep->lhsp()) {
} else if (funcp && !nodep->lhsp() && !funcp->isConstructor()) {
nodep->v3error("Return underneath a function should have return value");
} else if (!funcp && nodep->lhsp()) {
nodep->v3error("Return underneath a task shouldn't have return value");