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()) ) {