https://gcc.gnu.org/g:0d6d39457d02f48aafcbc93186775cd8ca6b2117

commit 0d6d39457d02f48aafcbc93186775cd8ca6b2117
Author: Pierre-Emmanuel Patry <pierre-emmanuel.pa...@embecosm.com>
Date:   Wed Nov 22 13:22:42 2023 +0100

    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.pa...@embecosm.com>

Diff:
---
 gcc/testsuite/rust/compile/const_trait_fn.rs | 4 ++++
 1 file changed, 4 insertions(+)

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 000000000000..cff2f5f096e5
--- /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 }
+}

Reply via email to