From: Pierre-Emmanuel Patry Date: Thu, 23 Nov 2023 13:08:50 +0000 (+0100) Subject: Add a regression test for function body check X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a48b4f860d2cca1893a6e4976d8b025d96217b59;p=thirdparty%2Fgcc.git Add a regression test for function body check 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 --- diff --git a/gcc/testsuite/rust/compile/functions_without_body.rs b/gcc/testsuite/rust/compile/functions_without_body.rs new file mode 100644 index 000000000000..36ddea52161e --- /dev/null +++ b/gcc/testsuite/rust/compile/functions_without_body.rs @@ -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() + // { dg-error "associated function in .impl. without body" "" { target *-*-* } .-1 } + where + T: Copy; + + fn test_c(); + // { 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 } +}