Skip to content

Commit

Permalink
Add regression test for const fn in trait
Browse files Browse the repository at this point in the history
Const fn declaration in trait declarations shall emit an error. This new
test highlight this behavior.

gcc/testsuite/ChangeLog:

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

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
  • Loading branch information
P-E-P committed Nov 22, 2023
1 parent 975f5a9 commit 1d9379d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gcc/testsuite/rust/compile/const_trait_fn.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
trait Osterkz {
const fn x();
// { dg-error "functions in traits cannot be declared const .E0379." "" { target *-*-* } .-1 }
}

0 comments on commit 1d9379d

Please sign in to comment.