Skip to content

Commit 5800d70

Browse files
committed
Add fn pointer implementation test
gcc/testsuite/ChangeLog: * rust/compile/impl_fnptr.rs: New test. Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
1 parent f088817 commit 5800d70

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#[lang = "sized"]
2+
pub trait Sized {}
3+
4+
#[lang = "eq"]
5+
pub trait PartialEq<Rhs: ?Sized = Self> {
6+
fn eq(&self, other: &Rhs) -> bool;
7+
8+
fn ne(&self, other: &Rhs) -> bool {
9+
!self.eq(other)
10+
}
11+
}
12+
13+
impl<Ret> PartialEq for extern "C" fn() -> Ret {
14+
#[inline]
15+
fn eq(&self, other: &Self) -> bool {
16+
*self as usize == *other as usize
17+
}
18+
}

0 commit comments

Comments
 (0)