Skip to content

Commit 87faf6a

Browse files
committed
transpile: Add snapshot test for #1506
1 parent 65ca2b9 commit 87faf6a

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

c2rust-transpile/tests/snapshots/exprs.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,12 @@ void compound_literal(){
3838
/// https://github.com/immunant/c2rust/issues/1234
3939
int i = (enum {A, B, C}){1};
4040
}
41+
42+
void statement_expr() {
43+
({
44+
puts("should execute");
45+
return;
46+
});
47+
48+
puts("should be unreachable!");
49+
}

c2rust-transpile/tests/snapshots/snapshots__transpile@exprs.c.snap

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ input_file: c2rust-transpile/tests/snapshots/exprs.c
1111
unused_assignments,
1212
unused_mut
1313
)]
14-
#![feature(raw_ref_op)]
14+
#![feature(label_break_value, raw_ref_op)]
1515
extern "C" {
1616
fn puts(str: *const ::core::ffi::c_char) -> ::core::ffi::c_int;
1717
}
@@ -56,3 +56,8 @@ pub unsafe extern "C" fn unary_with_side_effect() {
5656
pub unsafe extern "C" fn compound_literal() {
5757
let mut i: ::core::ffi::c_int = B as ::core::ffi::c_int;
5858
}
59+
#[no_mangle]
60+
pub unsafe extern "C" fn statement_expr() {
61+
puts(b"should execute\0" as *const u8 as *const ::core::ffi::c_char);
62+
puts(b"should be unreachable!\0" as *const u8 as *const ::core::ffi::c_char);
63+
}

0 commit comments

Comments
 (0)