Debian Codegraph @

gcc/testsuite/rust/compile/generics7.rs

raw
1 #[lang = "sized"]
2 pub trait Sized {}
3
4 struct Foo<A> {
5 a: A,
6 }
7
8 impl Foo<isize> {
9 fn bar(self) -> isize {
10 self.a
11 }
12 }
13
14 impl Foo<char> {
15 fn bar(self) -> char {
16 self.a
17 }
18 }
19
20 impl<T> Foo<T> {
21 fn bar(self) -> T {
22 self.a
23 }
24 }
25 // E0592
26 fn main() {
27 let a = Foo { a: 123 };
28 a.bar();
29 // { dg-error "duplicate definitions with name .bar." "" { target *-*-* } .-1 }
30 }