diff options
author | John Hodge <tpg@mutabah.net> | 2016-05-14 10:59:18 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-05-14 10:59:18 +0800 |
commit | f043a45fd21bab906cafc8964a892a64def65ec9 (patch) | |
tree | 63217329f82a015cff4fc6e78e37be606065ff64 /src/types.cpp | |
parent | 432892ea9ce604b6d12d6b087ad6328eb335f70c (diff) | |
download | mrust-f043a45fd21bab906cafc8964a892a64def65ec9.tar.gz |
Remove requirement for all variants of tagged unions to be empty-constructable
Diffstat (limited to 'src/types.cpp')
-rw-r--r-- | src/types.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/types.cpp b/src/types.cpp index 845af9d2..f3777666 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -798,7 +798,7 @@ void operator%(::Deserialiser& s, TypeData::Tag& c) { } #define _S(VAR, ...) case TypeData::TAG_##VAR: { const auto& ent = m_data.as_##VAR(); (void)&ent; __VA_ARGS__ } break; -#define _D(VAR, ...) case TypeData::TAG_##VAR: { m_data = TypeData::make_null_##VAR(); auto& ent = m_data.as_##VAR(); (void)&ent; __VA_ARGS__ } break; +#define _D(VAR, ...) case TypeData::TAG_##VAR: { m_data = TypeData::make_##VAR({}); auto& ent = m_data.as_##VAR(); (void)&ent; __VA_ARGS__ } break; SERIALISE_TYPE(TypeRef::, "TypeRef", { s % m_data.tag(); switch(m_data.tag()) @@ -854,6 +854,7 @@ SERIALISE_TYPE(TypeRef::, "TypeRef", { _D(Any) _D(Unit) _D(Macro, + m_data = TypeData::make_Macro({}); s.item( ent.inv ); ) _D(Primitive, |