Debian Codegraph @

gcc/testsuite/rust/compile/issue-852.rs

raw
1 // { dg-options "-w" }
2 extern "C" {
3 fn printf(s: *const i8, ...);
4 }
5
6 enum Foo {
7 A,
8 B(i32),
9 }
10
11 fn main() {
12 let result = Foo::B(123);
13
14 match result {
15 A => unsafe {
16 let a = "A\n\0";
17 let b = a as *const str;
18 let c = b as *const i8;
19
20 printf(c);
21 },
22 Foo::B(x) => unsafe {
23 let a = "Result: %i\n\0";
24 let b = a as *const str;
25 let c = b as *const i8;
26
27 printf(c, x);
28 },
29 }
30 }