From: Philip Herron <herron.phi...@googlemail.com>

gcc/testsuite/ChangeLog:

        * rust/execute/torture/const-generics-1.rs: New test.

Signed-off-by: Philip Herron <herron.phi...@googlemail.com>
---
 .../rust/execute/torture/const-generics-1.rs  | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 gcc/testsuite/rust/execute/torture/const-generics-1.rs

diff --git a/gcc/testsuite/rust/execute/torture/const-generics-1.rs 
b/gcc/testsuite/rust/execute/torture/const-generics-1.rs
new file mode 100644
index 00000000000..dbb7afe6835
--- /dev/null
+++ b/gcc/testsuite/rust/execute/torture/const-generics-1.rs
@@ -0,0 +1,24 @@
+#[lang = "sized"]
+trait Sized {}
+
+struct Foo<const N: usize>;
+
+impl Foo<1> {
+    fn call(&self) -> i32 {
+        10
+    }
+}
+
+impl Foo<2> {
+    fn call(&self) -> i32 {
+        20
+    }
+}
+
+fn main() -> i32 {
+    let a = Foo::<1> {};
+    let b = Foo::<2> {};
+    let aa = a.call();
+    let bb = b.call();
+    bb - aa - 10
+}
-- 
2.49.0

Reply via email to