gccrs: Handle `async` functions in traits
[official-gcc.git] / gcc / testsuite / rust / compile / const_generics_3.rs
blobe4e9008c4a694214492420f7afe32374afc98356
1 // { dg-additional-options "-w" }
3 const M: usize = 4;
5 struct Foo<T, const N: usize = 1> {
6     // FIXME: This error is bogus. But having it means parsing is valid!
7     value: [i32; N], // { dg-error "cannot find value .N. in this scope" }
10 fn main() {
11     let foo = Foo::<i32> { value: [15] };
12     let foo = Foo::<i32, 2> { value: [15, 13] };
13     let foo: Foo<i32, 2> = Foo { value: [15, 13] };
14     let foo: Foo<i32, 2> = Foo::<i32, 2> { value: [15, 13] };
15     let foo: Foo<i32, { 1 + 1 }> = Foo { value: [15, 13] };
16     let foo = Foo::<i32, { 1 + 1 }> { value: [15, 13] };
17     let foo: Foo<i32, { 1 + 1 }> = Foo::<i32, { 1 + 1 }> { value: [15, 13] };
18     let foo: Foo<i32, M> = Foo::<i32, 4> {
19         value: [15, 13, 11, 9],
20     };
22     // FIXME: Add proper const typecheck errors here
23     let invalid_foo: Foo<i32, { 1 + 1 }> = Foo::<i32, 3> { value: [15, 13] };
24     let invalid_foo: Foo<i32, { 1 + 1 }> = Foo::<i32, M> { value: [15, 13] };
25     let invalid_foo: Foo<i32> = Foo::<i32, 2> { value: [15, 13] };