Skip to content

Commit

Permalink
Add a regression test for function body check
Browse files Browse the repository at this point in the history
Function body check emit an error message when a required function body
is missing.

gcc/testsuite/ChangeLog:

	* rust/compile/functions_without_body.rs: New test.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
  • Loading branch information
P-E-P committed Dec 6, 2023
1 parent bc596aa commit a48b4f8
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions gcc/testsuite/rust/compile/functions_without_body.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
struct MyStruct;

trait X {}

fn test_a();
// { dg-error "free function without a body" "" { target *-*-* } .-1 }

impl MyStruct {
fn test_b<T>()
// { dg-error "associated function in .impl. without body" "" { target *-*-* } .-1 }
where
T: Copy;

fn test_c<T>();
// { dg-error "associated function in .impl. without body" "" { target *-*-* } .-1 }
}

impl X for MyStruct {
fn test_d();
// { dg-error "associated function in .impl. without body" "" { target *-*-* } .-1 }
}

0 comments on commit a48b4f8

Please sign in to comment.