mirror of
https://github.com/odin-lang/Odin.git
synced 2025-12-30 01:44:36 +00:00
Allow casting to and from rawptr and cstring #249
This commit is contained in:
@@ -1880,12 +1880,20 @@ bool check_is_castable_to(CheckerContext *c, Operand *operand, Type *y) {
|
||||
return true;
|
||||
}
|
||||
// cstring -> ^u8
|
||||
if (src == t_cstring && is_type_u8_ptr(dst)) {
|
||||
if (are_types_identical(src, t_cstring) && is_type_u8_ptr(dst)) {
|
||||
return true;
|
||||
}
|
||||
// cstring -> rawptr
|
||||
if (are_types_identical(src, t_cstring) && is_type_rawptr(dst)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ^u8 -> cstring
|
||||
if (is_type_u8_ptr(src) && dst == t_cstring) {
|
||||
if (is_type_u8_ptr(src) && are_types_identical(dst, t_cstring)) {
|
||||
return true;
|
||||
}
|
||||
// rawptr -> cstring
|
||||
if (is_type_rawptr(src) && are_types_identical(dst, t_cstring)) {
|
||||
return true;
|
||||
}
|
||||
// proc <-> proc
|
||||
|
||||
Reference in New Issue
Block a user