aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-11-22 13:22:42 +0100
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-30 12:36:47 +0100
commitab257dcd66cd2532beb0c74b836147d02a9ed3bb (patch)
tree4fe5fa81453b899c434f855a11996342421096d3
parent9279483f6e87258e36345c355720860925a75e3e (diff)
downloadgcc-ab257dcd66cd2532beb0c74b836147d02a9ed3bb.zip
gcc-ab257dcd66cd2532beb0c74b836147d02a9ed3bb.tar.gz
gcc-ab257dcd66cd2532beb0c74b836147d02a9ed3bb.tar.bz2
gccrs: Add regression test for const fn in trait
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 <pierre-emmanuel.patry@embecosm.com>
-rw-r--r--gcc/testsuite/rust/compile/const_trait_fn.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/const_trait_fn.rs b/gcc/testsuite/rust/compile/const_trait_fn.rs
new file mode 100644
index 0000000..cff2f5f
--- /dev/null
+++ b/gcc/testsuite/rust/compile/const_trait_fn.rs
@@ -0,0 +1,4 @@
+trait Osterkz {
+ const fn x();
+ // { dg-error "functions in traits cannot be declared const .E0379." "" { target *-*-* } .-1 }
+}