From 79ba59f3f12eb205ec187cc07b67d861576fdbcb Mon Sep 17 00:00:00 2001 From: Boris Batkin Date: Mon, 23 Dec 2024 09:47:26 -0800 Subject: [PATCH] do not crash on attempt to promote --- src/ast/ast_infer_type.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ast/ast_infer_type.cpp b/src/ast/ast_infer_type.cpp index 159245e16..dd85ba45e 100644 --- a/src/ast/ast_infer_type.cpp +++ b/src/ast/ast_infer_type.cpp @@ -6617,7 +6617,7 @@ namespace das { } } inferReturnType(func->result, expr); - if ( func->moveOnReturn && !expr->moveSemantics ) { + if ( func->moveOnReturn && !expr->moveSemantics && expr->subexpr ) { error("this type can't be copied; " + describeType(func->result),"","use return <- instead", expr->at, CompilationError::invalid_return_semantics ); if ( canRelaxAssign(expr->subexpr.get()) ) {