mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
int? ? was not correctly handled. #2786
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
- Inferring the size of a slice with an inner inferred array using {} isn't detected as error #2783
|
||||
- Bug in sysv abi when passing union in with floats #2784
|
||||
- When a global const has invalid attributes, handling is incorrect, leading to a crash #2785.
|
||||
- `int? ?` was not correctly handled. #2786
|
||||
|
||||
### Fixes
|
||||
- Regression with npot vector in struct triggering an assert #2219.
|
||||
|
||||
@@ -1015,12 +1015,6 @@ static inline Ast *parse_decl_or_expr_stmt(ParseContext *c)
|
||||
return parse_ct_type_assign_stmt(c);
|
||||
}
|
||||
ASSIGN_EXPR_OR_RET(Expr *expr, parse_expr(c), poisoned_ast);
|
||||
// We might be parsing "int!"
|
||||
// If so we need to unwrap this.
|
||||
if (expr->expr_kind == EXPR_OPTIONAL && expr->inner_expr->expr_kind == EXPR_TYPEINFO)
|
||||
{
|
||||
UNREACHABLE
|
||||
}
|
||||
if (expr->expr_kind == EXPR_TYPEINFO)
|
||||
{
|
||||
ASSIGN_AST_OR_RET(Ast *ast, parse_decl_stmt_after_type(c, expr->type_expr), poisoned_ast);
|
||||
|
||||
3
test/test_suite/statements/optional_with_question.c3
Normal file
3
test/test_suite/statements/optional_with_question.c3
Normal file
@@ -0,0 +1,3 @@
|
||||
fn void main()
|
||||
{
|
||||
char? ~ // #error: Expected a fault before '~'
|
||||
Reference in New Issue
Block a user