Debian Codegraph @

gcc/testsuite/rust/compile/const_generics_8.rs

raw
1 #[lang = "sized"]
2 pub trait Sized {}
3
4 struct Bidule<const N: i32 = 15> {}
5 enum Bidoule<const N: i32 = 15> {}
6
7 // Note - missing generic parameter - needs name resolution on const generics
8 type Bipboupe<const N: i32 = 15> = Bidule;
9 trait Fooable<const N: i32 = 15> {}
10
11 union Bidoulepe<const N: i32 = 15> {
12 // { dg-error "default values for const generic parameters are not allowed in .union. items" "" {target *-*-* } .-1 }
13 int: i32,
14 float: f32,
15 }
16
17 fn const_default<const N: i32 = 15>() {} // { dg-error "default values for const generic parameters are not allowed in .function. items" }
18
19 // Note - missing generic parameter - needs name resolution on const generics
20 impl<const N: i32 = 15> Bidule {} // { dg-error "default values for const generic parameters are not allowed in .impl. items" }