diff options
Diffstat (limited to 'src/hir_typeck/expr_check.cpp')
-rw-r--r-- | src/hir_typeck/expr_check.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/hir_typeck/expr_check.cpp b/src/hir_typeck/expr_check.cpp index 9e369e61..d0fe6a5d 100644 --- a/src/hir_typeck/expr_check.cpp +++ b/src/hir_typeck/expr_check.cpp @@ -473,6 +473,14 @@ namespace { TODO(sp, "Union in StructLiteral"); ), (Struct, + if( e->m_data.is_Unit() ) + { + ASSERT_BUG(node.span(), node.m_values.size() == 0, "Values provided for unit-like struct"); + ASSERT_BUG(node.span(), ! node.m_base_value, "Values provided for unit-like struct"); + return ; + } + + ASSERT_BUG(node.span(), e->m_data.is_Named(), "StructLiteral not pointing to a braced struct, instead " << e->m_data.tag_str() << " - " << ty); fields_ptr = &e->m_data.as_Named(); ) ) |