From 9907d211ff5fa408a7eb6387ef0ceaedaeea2d32 Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Fri, 23 Jul 2021 12:57:45 +0100 Subject: [PATCH] Make VlWide and VlUnpacked C++20 compatible aggregates. C++20 requires that aggregate types do not have a user declared constructor, not even an explicitly defaulted one. We need these types to be aggregates for static initialization. Fixes #3076. --- include/verilated_heavy.h | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/include/verilated_heavy.h b/include/verilated_heavy.h index a0f8107bd..150991a19 100644 --- a/include/verilated_heavy.h +++ b/include/verilated_heavy.h @@ -107,15 +107,12 @@ template struct VlWide final { EData m_storage[T_Words]; // Contents of the packed array // CONSTRUCTORS - // cppcheck-suppress uninitVar - VlWide() = default; - ~VlWide() = default; - VlWide(const VlWide&) = default; - VlWide(VlWide&&) = default; + // Default constructors and destructor are used. Note however that C++20 requires that + // aggregate types do not have a user declared constructor, not even an explicitly defaulted + // one. // OPERATOR METHODS - VlWide& operator=(const VlWide&) = default; - VlWide& operator=(VlWide&&) = default; + // Default copy assignment operators are used. operator WDataOutP() { return &m_storage[0]; } // This also allows [] operator WDataInP() const { return &m_storage[0]; } // This also allows [] @@ -818,12 +815,12 @@ template struct VlUnpacked final { T_Value m_storage[T_Depth]; // Contents of the unpacked array // CONSTRUCTORS - VlUnpacked() = default; - ~VlUnpacked() = default; - VlUnpacked(const VlUnpacked&) = default; - VlUnpacked(VlUnpacked&&) = default; - VlUnpacked& operator=(const VlUnpacked&) = default; - VlUnpacked& operator=(VlUnpacked&&) = default; + // Default constructors and destructor are used. Note however that C++20 requires that + // aggregate types do not have a user declared constructor, not even an explicitly defaulted + // one. + + // OPERATOR METHODS + // Default copy assignment operators are used. // METHODS // Raw access