Debian Codegraph @

gcc/testsuite/rust/compile/generics10.rs

raw
1 struct Foo<A, B>(A, B);
2
3 impl<X = i32> Foo<X, f32> { // { dg-error "defaults for type parameters are only allowed in .struct., .enum., .type., or .trait. definitions" }
4 fn new(a: X, b: f32) -> Self {
5 Self(a, b)
6 }
7 }
8
9 fn main() {
10 let a;
11 a = Foo::new(123, 456f32);
12 }