mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Fix bug where &i[0] = null was not detected to be an error. #1833
This commit is contained in:
@@ -140,7 +140,8 @@ enum EventType : (long val)
|
||||
|
||||
fn EventType! event_type_from(int val)
|
||||
{
|
||||
switch(val) {
|
||||
switch(val)
|
||||
{
|
||||
case EventType.LEFT_MOUSE_DOWN.val: return LEFT_MOUSE_DOWN;
|
||||
case EventType.LEFT_MOUSE_UP.val: return LEFT_MOUSE_UP;
|
||||
case EventType.RIGHT_MOUSE_DOWN.val: return RIGHT_MOUSE_DOWN;
|
||||
|
||||
@@ -83,6 +83,7 @@
|
||||
- Fix bug when multiple `$else` clauses followed an `$if` #1824.
|
||||
- Report the correct type as not having a method when access fails #1828.
|
||||
- Prevent temp arena scribbling from causing an asan warning. #1825
|
||||
- Fix bug where `&i[0] = null` was not detected to be an error #1833.
|
||||
|
||||
### Stdlib changes
|
||||
- Increase BitWriter.write_bits limit up to 32 bits.
|
||||
|
||||
@@ -510,7 +510,6 @@ static bool sema_binary_is_expr_lvalue(SemaContext *context, Expr *top_expr, Exp
|
||||
case EXPR_SUBSCRIPT:
|
||||
case EXPR_SLICE:
|
||||
case EXPR_SUBSCRIPT_ASSIGN:
|
||||
case EXPR_SUBSCRIPT_ADDR:
|
||||
goto CHECK_OPTIONAL;
|
||||
case EXPR_HASH_IDENT:
|
||||
if (failed_ref) goto FAILED_REF;
|
||||
@@ -595,6 +594,7 @@ static bool sema_binary_is_expr_lvalue(SemaContext *context, Expr *top_expr, Exp
|
||||
case EXPR_VECTOR_TO_ARRAY:
|
||||
case EXPR_SLICE_TO_VEC_ARRAY:
|
||||
case EXPR_SCALAR_TO_VECTOR:
|
||||
case EXPR_SUBSCRIPT_ADDR:
|
||||
goto ERR;
|
||||
}
|
||||
UNREACHABLE
|
||||
|
||||
7
test/test_suite/expressions/assign_to_address.c3
Normal file
7
test/test_suite/expressions/assign_to_address.c3
Normal file
@@ -0,0 +1,7 @@
|
||||
// Issue #1833
|
||||
fn int main()
|
||||
{
|
||||
int* i;
|
||||
&i[0] = null; // #error: An assignable expression
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user