Skip to content

Commit

Permalink
Casting a slice address to its pointer type should not compile #1193.
Browse files Browse the repository at this point in the history
  • Loading branch information
lerno committed May 15, 2024
1 parent 7d8cc87 commit 555a4ab
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions releasenotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- Casting to a bitstruct would be allowed even if the type was the wrong size.
- Generic modules parameterized with constants would sometimes get the wrong parameterized module name causing conversion errors #1192.
- Duplicate emit of expressions on negation would incorrectly compile negated macros.
- Casting a slice address to its pointer type should not compile #1193.

### Stdlib changes
- Add 'zstr' variants for `string::new_format` / `string::tformat`.
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -676,9 +676,9 @@ typedef enum
TYPE_FAULTTYPE,
TYPE_TYPEDEF,
TYPE_DISTINCT,
TYPE_SUBARRAY,
TYPE_ARRAY,
TYPE_FIRST_ARRAYLIKE = TYPE_ARRAY,
TYPE_SUBARRAY,
TYPE_FLEXIBLE_ARRAY,
TYPE_INFERRED_ARRAY,
TYPE_VECTOR,
Expand Down
7 changes: 7 additions & 0 deletions test/test_suite/cast/cast_slice_implicit.c3
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fn void foo()
{
int[] array;
int* ptr = array;
void* ptr2 = &array;
int* ptr3 = &array; // #error: is not permitted
}

0 comments on commit 555a4ab

Please sign in to comment.