Skip to content

Commit

Permalink
do not crash on attempt to promote
Browse files Browse the repository at this point in the history
  • Loading branch information
borisbat committed Dec 23, 2024
1 parent 5a39d7b commit 79ba59f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ast/ast_infer_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) ) {
Expand Down

0 comments on commit 79ba59f

Please sign in to comment.