Skip to content

returning a single-scalar #[repr(C)] struct causes PassMode::Cast and failure #373

New issue

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

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

Already on GitHub? # to your account

Closed
khyperia opened this issue Jan 13, 2021 · 0 comments · Fixed by #766
Closed

returning a single-scalar #[repr(C)] struct causes PassMode::Cast and failure #373

khyperia opened this issue Jan 13, 2021 · 0 comments · Fixed by #766
Labels
t: bug Something isn't working

Comments

@khyperia
Copy link
Contributor

Originally reported in #361 (comment)

#[test]
fn struct_f32_return() {
    val(r#"
#[derive(Copy, Clone)]
#[repr(C)]
pub struct S {
    x: f32,
}
fn f() -> S { S { x: 2.0 } }
#[allow(unused_attributes)]
#[spirv(fragment)]
pub fn main() {
    f();
}
"#);
}
error: Cannot cast between pointer types
  --> src/lib.rs:14:29
   |
14 | fn f() -> S { S { x: 2.0 } }
   |                             ^
   |
   = note: from: *{Function} struct S { x: f32 }
   = note: to: *{Function} u32

error: Cannot cast between pointer types
  --> src/lib.rs:18:5
   |
18 |     f();
   |     ^^^
   |
   = note: from: *{Function} struct S { x: f32 }
   = note: to: *{Function} u32
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
t: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant