| 1 |
#[lang = "sized"] |
| 2 |
pub trait Sized {} |
| 3 |
|
| 4 |
struct Foo<T>(T, bool); |
| 5 |
|
| 6 |
impl Foo<i32> { |
| 7 |
fn new() -> Self { |
| 8 |
Foo(123, true) |
| 9 |
} |
| 10 |
|
| 11 |
fn bar(self) -> i32 { |
| 12 |
self.0 |
| 13 |
} |
| 14 |
} |
| 15 |
|
| 16 |
impl Foo<f32> { |
| 17 |
fn new() -> Self { |
| 18 |
Foo(123f32, true) |
| 19 |
} |
| 20 |
|
| 21 |
fn bar(self) -> f32 { |
| 22 |
self.0 |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
fn main() { |
| 27 |
let a = Foo::<i32>::new(); |
| 28 |
let aa: i32 = a.bar(); |
| 29 |
// { dg-warning "unused name" "" { target *-*-* } .-1 } |
| 30 |
|
| 31 |
let b = Foo::<f32>::new(); |
| 32 |
let bb: f32 = b.bar(); |
| 33 |
// { dg-warning "unused name" "" { target *-*-* } .-1 } |
| 34 |
} |