diff options
author | John Hodge <tpg@mutabah.net> | 2016-03-10 14:11:27 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-03-10 14:11:27 +0800 |
commit | 5ff7dc38aa25eeeda7ef01753eca40e7a514b328 (patch) | |
tree | f70f25f185732796e20226f3ad1bfc68ec94ebde /src/include | |
parent | b0e44483f1f598d6e3aa5ca8b325560a843f162f (diff) | |
download | mrust-5ff7dc38aa25eeeda7ef01753eca40e7a514b328.tar.gz |
Tagged Union - Fix incorrect use of destructor in move assignment
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/tagged_union.hpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/include/tagged_union.hpp b/src/include/tagged_union.hpp index d0d6ef7e..7019f34e 100644 --- a/src/include/tagged_union.hpp +++ b/src/include/tagged_union.hpp @@ -197,8 +197,8 @@ class _name TU_EXP _inherit { \ _name(): m_tag(TAG_##_def) { new((void*)m_data) TU_DATANAME(_def); }/* */ _name(const _name&) = delete;/* */ _name(_name&& x) noexcept: m_tag(x.m_tag) TU_EXP _extra_move { switch(m_tag) { TU_MOVE_CASES _variants } }/* -*/ _name& operator =(_name&& x) { this->~_name(); m_tag = x.m_tag; TU_EXP _extra_assign switch(m_tag) { TU_MOVE_CASES _variants }; return *this; }/* -*/ ~_name() { switch(m_tag) { TU_DEST_CASES _variants } } \ +*/ _name& operator =(_name&& x) { switch(m_tag) { TU_DEST_CASES _variants } m_tag = x.m_tag; TU_EXP _extra_assign switch(m_tag) { TU_MOVE_CASES _variants }; return *this; }/* +*/ ~_name() { switch(m_tag) { TU_DEST_CASES _variants } m_tag = TAG_##_def; new((void*)m_data) TU_DATANAME(_def); } \ \ Tag tag() const { return m_tag; }\ TU_CONSS(_name, TU_EXP _variants) \ |