Fix constant function return of function var, bug1467.

This commit is contained in:
Wilson Snyder
2019-06-15 08:03:39 -04:00
parent 0d71c1154d
commit 90af180ec1
4 changed files with 87 additions and 7 deletions
+11 -7
View File
@@ -1658,13 +1658,17 @@ V3Number& V3Number::opBufIf1(const V3Number& ens, const V3Number& if1s) {
}
V3Number& V3Number::opAssign(const V3Number& lhs) {
// Note may be a width change during the assign
setZero();
if (isString()) {
m_stringVal = lhs.m_stringVal;
} else {
for (int bit=0; bit<this->width(); bit++) {
setBit(bit, lhs.bitIs(bit));
// Note may be a width change during the assign.
// Special case: opAssign unlike other ops, allows this an assignment
// to itself; V3Simulate does this when hits "foo=foo;"
if (this != &lhs) {
setZero();
if (isString()) {
m_stringVal = lhs.m_stringVal;
} else {
for (int bit=0; bit<this->width(); bit++) {
setBit(bit, lhs.bitIs(bit));
}
}
}
return *this;