diff --git a/src/V3Ast.h b/src/V3Ast.h index 2295ff743..3dac483ea 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -1136,10 +1136,11 @@ public: explicit VNUser(void* p) { m_u.up = p; } ~VNUser() = default; // Casters - WidthVP* c() const { return reinterpret_cast(m_u.up); } - VSymEnt* toSymEnt() const { return reinterpret_cast(m_u.up); } - AstNode* toNodep() const { return reinterpret_cast(m_u.up); } - V3GraphVertex* toGraphVertex() const { return reinterpret_cast(m_u.up); } + template T* toPtr() const { return reinterpret_cast(m_u.up); } + WidthVP* c() const { return toPtr(); } + VSymEnt* toSymEnt() const { return toPtr(); } + AstNode* toNodep() const { return toPtr(); } + V3GraphVertex* toGraphVertex() const { return toPtr(); } int toInt() const { return m_u.ui; } static VNUser fromInt(int i) { return VNUser(i); } };