1 // { dg-additional-options "-w" }
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" }
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],
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] };