]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Add a regression test for async const functions
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Wed, 22 Nov 2023 10:12:05 +0000 (11:12 +0100)
committerP-E-P <32375388+P-E-P@users.noreply.github.com>
Fri, 1 Dec 2023 09:14:09 +0000 (09:14 +0000)
Functions that are both async and const shall be rejected during the
AST validation pass. This new test highlight this behavior.

gcc/testsuite/ChangeLog:

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

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/testsuite/rust/compile/const_async_function.rs [new file with mode: 0644]

diff --git a/gcc/testsuite/rust/compile/const_async_function.rs b/gcc/testsuite/rust/compile/const_async_function.rs
new file mode 100644 (file)
index 0000000..fb1c4dd
--- /dev/null
@@ -0,0 +1,3 @@
+// { dg-additional-options "-frust-edition=2018" }
+const async fn weird_function() {}
+// { dg-error "functions cannot be both .const. and .async." "" { target *-*-* } .-1 }