aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/generics7.rs
blob: dcedead4b9f32d0ff7f669da2eb53b3662c8c38c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#[lang = "sized"]
pub trait Sized {}

struct Foo<A> {
    a: A,
}

impl Foo<isize> {
    fn bar(self) -> isize {
        self.a
    }
}

impl Foo<char> {
    fn bar(self) -> char {
        self.a
    }
}

impl<T> Foo<T> {
    fn bar(self) -> T {
        self.a
    }
}
// E0592
fn main() {
    let a = Foo { a: 123 };
    a.bar();
    // { dg-error "duplicate definitions with name .bar." "" { target *-*-* } .-1 }
}