mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
- Compiler crash using ?? with a void? macro #2973
This commit is contained in:
@@ -58,6 +58,7 @@
|
||||
- Member access on a struct returned by the assignment expression, cause crash #2947
|
||||
- Trying to slice an indexable type leads to misleading error message #2958
|
||||
- Warn on use of visibility modifiers on methods. #2962
|
||||
- Compiler crash using `??` with a `void?` macro #2973
|
||||
|
||||
## 0.7.9 Change list
|
||||
|
||||
|
||||
@@ -3921,7 +3921,7 @@ static void llvm_emit_else(GenContext *c, BEValue *be_value, Expr *expr)
|
||||
assert(success_end_block && else_block_exit);
|
||||
|
||||
// We might have a void here
|
||||
if (!real_value.value)
|
||||
if (!real_value.value || LLVMIsUndef(real_value.value))
|
||||
{
|
||||
assert(type_flatten(expr->type) == type_void);
|
||||
assert(!else_value.value);
|
||||
|
||||
17
test/test_suite/errors/else_check_void.c3t
Normal file
17
test/test_suite/errors/else_check_void.c3t
Normal file
@@ -0,0 +1,17 @@
|
||||
module test;
|
||||
|
||||
faultdef MALFORMED_RESPONSE;
|
||||
macro void? set_field(String[] tokens)
|
||||
{
|
||||
if (tokens.len < 2) return MALFORMED_RESPONSE~;
|
||||
}
|
||||
|
||||
fn void main()
|
||||
{
|
||||
String[] tokens = { "a", "b" };
|
||||
set_field(tokens) ?? (void)1;
|
||||
}
|
||||
|
||||
/* #expect: test.ll
|
||||
|
||||
fefe
|
||||
Reference in New Issue
Block a user