Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Function call in array index generates uncompilable C code for the backend #44

Open
lefticus opened this issue Mar 10, 2024 · 0 comments

Comments

@lefticus
Copy link
Collaborator

fun get_val() -> i64 {
  return 1;
}

let data = raw[1,2,3]
unsafe {
  // note that a literal here, or an explicitly typed
  // index do work in this case.
  data[get_val()]
}

error:

/home/jason/june/examples/june_hello_world/build/debug/main.c:395:71: error: too few arguments to function call, single argument 'allocation_id' was not specified
(*((/* data */ variable_2) + (/* get_val */ function_1(/* UNKNOWN, */ ))));
                                            ~~~~~~~~~~                ^
/home/jason/june/examples/june_hello_world/build/debug/main.c:387:23: note: 'function_1' declared here
int64_t /* get_val */ function_1(long allocation_id){
                      ^
1 error generated.
thread 'main' panicked at src/main.rs:90:17:
Clang did not compile successfully
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

See related issue #43 and #41

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant