public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-8580] gccrs: Add regression test for const fn in trait
@ 2024-01-30 11:59 Arthur Cohen
  0 siblings, 0 replies; only message in thread
From: Arthur Cohen @ 2024-01-30 11:59 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:ab257dcd66cd2532beb0c74b836147d02a9ed3bb

commit r14-8580-gab257dcd66cd2532beb0c74b836147d02a9ed3bb
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date:   Wed Nov 22 13:22:42 2023 +0100

    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>

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 }
+}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-30 11:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-30 11:59 [gcc r14-8580] gccrs: Add regression test for const fn in trait Arthur Cohen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).