From ee090168fd7f678e40150b3699e335625b90d947 Mon Sep 17 00:00:00 2001 From: Zuhaitz Méndez Fernández de Aránguiz Date: Thu, 29 Jan 2026 22:45:43 +0000 Subject: Fix for #150 --- src/parser/parser_expr.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/parser/parser_expr.c b/src/parser/parser_expr.c index 8f3579a..51d2baa 100644 --- a/src/parser/parser_expr.c +++ b/src/parser/parser_expr.c @@ -156,6 +156,14 @@ int is_type_copy(ParserContext *ctx, Type *t) { return 1; } + + // If the struct is NOT defined (opaque/C type) and does NOT implement Drop, + // treat it as Copy (C behavior). + if (!find_struct_def(ctx, t->name) && !check_impl(ctx, "Drop", t->name)) + { + return 1; + } + return 0; case TYPE_ARRAY: @@ -164,6 +172,13 @@ int is_type_copy(ParserContext *ctx, Type *t) // but if it's a value assignment, C doesn't support it anyway unless wrapped in struct. return 0; + case TYPE_ALIAS: + if (t->alias.is_opaque_alias) + { + return 1; + } + return is_type_copy(ctx, t->inner); + default: return 1; } -- cgit v1.2.3