diff options
Diffstat (limited to 'gcc/testsuite/rust/compile/deadcode_err2.rs')
-rw-r--r-- | gcc/testsuite/rust/compile/deadcode_err2.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/deadcode_err2.rs b/gcc/testsuite/rust/compile/deadcode_err2.rs new file mode 100644 index 0000000..8c0eb46 --- /dev/null +++ b/gcc/testsuite/rust/compile/deadcode_err2.rs @@ -0,0 +1,16 @@ +fn foo() -> i32 { + return 1; + return 1.5; // { dg-error "expected .i32. got .<float>." } + // { dg-warning "unreachable statement" "" { target *-*-* } .-1 } +} + +fn bar() -> i32 { + return 1.5; // { dg-error "expected .i32. got .<float>." } + return 1; + // { dg-warning "unreachable statement" "" { target *-*-* } .-1 } +} + +fn main() { + foo(); + bar(); +} |