mirror of
https://github.com/odin-lang/Odin.git
synced 2026-07-11 02:19:30 +00:00
Allow #no_alias on any pointer-like type
This commit is contained in:
@@ -2221,8 +2221,9 @@ gb_internal Type *check_get_params(CheckerContext *ctx, Scope *scope, Ast *_para
|
||||
}
|
||||
|
||||
if (p->flags&FieldFlag_no_alias) {
|
||||
if (!is_type_pointer(type) && !is_type_multi_pointer(type)) {
|
||||
error(name, "'#no_alias' can only be applied pointer or multi-pointer typed parameters");
|
||||
bool ok = is_type_internally_pointer_like(type);
|
||||
if (!ok) {
|
||||
error(name, "'#no_alias' can only be applied pointer-like type parameters");
|
||||
p->flags &= ~FieldFlag_no_alias; // Remove the flag
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1529,7 +1529,7 @@ gb_internal bool is_type_multi_pointer(Type *t) {
|
||||
return t->kind == Type_MultiPointer;
|
||||
}
|
||||
gb_internal bool is_type_internally_pointer_like(Type *t) {
|
||||
return is_type_pointer(t) || is_type_multi_pointer(t) || is_type_cstring(t) || is_type_proc(t);
|
||||
return is_type_pointer(t) || is_type_multi_pointer(t) || is_type_cstring(t) || is_type_cstring16(t) || is_type_proc(t);
|
||||
}
|
||||
|
||||
gb_internal bool is_type_tuple(Type *t) {
|
||||
|
||||
Reference in New Issue
Block a user