From e01374503582f08e3f9d0d9b0028d912d3e9a8f8 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Fri, 14 Aug 2020 12:30:05 +0100 Subject: [PATCH] Fix GitHub issue #361 - explicit cast check on function return value. A function call returning an enumeration value can be assigned to an enumeration variable without an explict cast. (cherry picked from commit bd0133b386d1b40efc4271afe11d4db6824bf5f5) --- netlist.cc | 8 ++++++++ netlist.h | 1 + 2 files changed, 9 insertions(+) diff --git a/netlist.cc b/netlist.cc index 5ad69fece..9c4a640c1 100644 --- a/netlist.cc +++ b/netlist.cc @@ -2154,6 +2154,14 @@ ivl_variable_type_t NetEUFunc::expr_type() const return IVL_VT_VOID; } +const netenum_t* NetEUFunc::enumeration() const +{ + if (result_sig_) + return result_sig_->enumeration(); + + return 0; +} + NetUTask::NetUTask(NetScope*def) : task_(def) { diff --git a/netlist.h b/netlist.h index 709222d79..891bd88f6 100644 --- a/netlist.h +++ b/netlist.h @@ -3714,6 +3714,7 @@ class NetEUFunc : public NetExpr { const NetScope* func() const; virtual ivl_variable_type_t expr_type() const; + virtual const netenum_t* enumeration() const; virtual void dump(ostream&) const; virtual void expr_scan(struct expr_scan_t*) const;