From 1a92a44c7d407187b107b5cf3691b334127efcf8 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Thu, 26 Nov 2020 09:38:47 -0500 Subject: [PATCH] Internals: Assert on misexpected 'new'. --- src/V3Width.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/V3Width.cpp b/src/V3Width.cpp index 4bb7da94d..6291db047 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -3091,7 +3091,8 @@ private: virtual void visit(AstNew* nodep) override { if (nodep->didWidthAndSet()) return; - AstClassRefDType* refp = VN_CAST(m_vup->dtypeNullSkipRefp(), ClassRefDType); + AstClassRefDType* refp + = m_vup ? VN_CAST(m_vup->dtypeNullSkipRefp(), ClassRefDType) : nullptr; if (!refp) { // e.g. int a = new; nodep->v3error("new() not expected in this context"); return;