gccrs: const generics: Make sure const generic types are visited properly
authorArthur Cohen <arthur.cohen@embecosm.com>
Mon, 12 Sep 2022 13:53:01 +0000 (15:53 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 31 Jan 2023 13:16:51 +0000 (14:16 +0100)
...in all contexts.

gcc/testsuite/ChangeLog:

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

gcc/testsuite/rust/compile/const_generics_7.rs [new file with mode: 0644]

diff --git a/gcc/testsuite/rust/compile/const_generics_7.rs b/gcc/testsuite/rust/compile/const_generics_7.rs
new file mode 100644 (file)
index 0000000..2c128db
--- /dev/null
@@ -0,0 +1,17 @@
+struct S<const N: usize>;
+
+pub fn foo<const N: FooBar>() {} // { dg-error "failed to resolve" }
+type Foo<const N: FooBar> = S<N>; // { dg-error "failed to resolve" }
+struct Foo2<const N: FooBar>; // { dg-error "failed to resolve" }
+enum Foo3<const N: FooBar> { // { dg-error "failed to resolve" }
+    Foo,
+    Bar,
+}
+union Foo4<const N: FooBar> { // { dg-error "failed to resolve" }
+    a: usize,
+    b: i32,
+}
+trait Fooable<const N: FooBar> {} // { dg-error "failed to resolve" }
+
+trait Traitable {}
+impl<const N: FooBar> Traitable for Foo2<N> {} // { dg-error "failed to resolve" }