Add error on missing forward declarations (#6207).

This commit is contained in:
Wilson Snyder
2025-07-26 17:11:35 -04:00
parent d8dbb08a95
commit f3560837ec
16 changed files with 234 additions and 33 deletions
+1 -13
View File
@@ -782,19 +782,7 @@ class ParamProcessor final {
// Constify may have caused pinp->exprp to change
rawTypep = VN_AS(pinp->exprp(), NodeDType);
exprp = rawTypep->skipRefToNonRefp();
bool ok = true;
switch (modvarp->fwdType()) {
case VFwdType::NONE: ok = true; break;
case VFwdType::ENUM: ok = VN_IS(exprp, EnumDType); break;
case VFwdType::STRUCT: ok = VN_IS(exprp, StructDType); break;
case VFwdType::UNION: ok = VN_IS(exprp, UnionDType); break;
case VFwdType::CLASS: ok = VN_IS(exprp, ClassRefDType); break;
case VFwdType::INTERFACE_CLASS: // TODO: Over permissive for now:
ok = VN_IS(exprp, ClassRefDType);
break;
default: modvarp->v3fatalSrc("Bad case");
}
if (!ok) {
if (!modvarp->fwdType().isNodeCompatible(exprp)) {
pinp->v3error("Parameter type expression type "
<< exprp->prettyDTypeNameQ()
<< " violates parameter's forwarding type '"