Casting a slice address to its pointer type should not compile #1193.

This commit is contained in:
Christoffer Lerno
2024-05-15 21:36:53 +02:00
parent 7d8cc8776d
commit 555a4ab4c5
3 changed files with 9 additions and 1 deletions

View File

@@ -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`.

View File

@@ -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,

View File

@@ -0,0 +1,7 @@
fn void foo()
{
int[] array;
int* ptr = array;
void* ptr2 = &array;
int* ptr3 = &array; // #error: is not permitted
}