gcc/testsuite/rust/compile/traits7.rs
raw| 1 | #[lang = "sized"] |
| 2 | pub trait Sized {} |
| 3 | |
| 4 | trait Foo { |
| 5 | fn default() -> i32; |
| 6 | } |
| 7 | |
| 8 | trait Bar { |
| 9 | fn not_default() -> i32; |
| 10 | } |
| 11 | |
| 12 | struct Test(i32); |
| 13 | |
| 14 | impl Foo for Test { |
| 15 | fn default() -> i32 { |
| 16 | 1234 |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | fn type_bound_test<T: Foo + Bar>() -> i32 { |
| 21 | T::default() |
| 22 | } |
| 23 | |
| 24 | fn main() { |
| 25 | let a = type_bound_test::<Test>(); |
| 26 | // { dg-error "bounds not satisfied for Test" "" { target *-*-* } .-1 } |
| 27 | } |