diff options
| author | gingerBill <bill@gingerbill.org> | 2024-06-08 16:07:28 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-06-08 16:07:28 +0100 |
| commit | be0774acc8a67ac2f9e003764284bbda21d4ebcd (patch) | |
| tree | 356fd271fe53fc369a46855ff4743c15e77c5d3e /src/check_stmt.cpp | |
| parent | 7e994b6d216b091b90c47eba1b834bc7c690535c (diff) | |
Add error message on return a constant slice value from a procedure
Diffstat (limited to 'src/check_stmt.cpp')
| -rw-r--r-- | src/check_stmt.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index 65bac36be..c37c58cd6 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -2501,6 +2501,10 @@ gb_internal void check_return_stmt(CheckerContext *ctx, Ast *node) { unsafe_return_error(o, "the address of an indexed variable", f->type); } } + } else if (o.mode == Addressing_Constant && is_type_slice(o.type)) { + ERROR_BLOCK(); + unsafe_return_error(o, "a compound literal of a slice"); + error_line("\tNote: A constant slice value will use the memory of the current stack frame\n"); } } |