5 * C-like enums have to be represented as LLVM ints, not wrapped in a
6 * struct, because it's important for the FFI that they interoperate
7 * with C integers/enums, and the ABI can treat structs differently.
8 * For example, on i686-linux-gnu, a struct return value is passed by
9 * storing to a hidden out parameter, whereas an integer would be
10 * returned in a register.
12 * This test just checks that the ABIs for the enum and the plain
13 * integer are compatible, rather than actually calling C code.
14 * The unused parameter to `foo` is to increase the likelihood of
15 * crashing if something goes wrong here.
25 extern "C" fn foo(_x: usize) -> Foo { Foo::B }
29 let f: extern "C" fn(usize) -> u32 =
30 ::std::mem::transmute(foo as extern "C" fn(usize) -> Foo);
31 assert_eq!(f(0xDEADBEEF), Foo::B as u32);