Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant