From 6d391dc04f0faa3248d64aa36faf38cf9e4e5fa2 Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Tue, 14 Oct 2014 13:10:55 +0200 Subject: [PATCH] Even more typecasting of member function pointers in smobs.tcc This is yet-another-bugfix in order to get a rather inconspicuous member function pointer comparison accepted by old GCC versions. --- lily/include/smobs.tcc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lily/include/smobs.tcc b/lily/include/smobs.tcc index 7b51792567..3a8e8c4f23 100644 --- a/lily/include/smobs.tcc +++ b/lily/include/smobs.tcc @@ -128,9 +128,12 @@ void Smob_base::init () if (&Super::free_smob != &Smob_base::free_smob) scm_set_smob_free (smob_tag_, Super::free_smob); - // Old GCC versions refuse comparing pointers-to-member-function of - // covariant types, so we recast here. - if (&Super::mark_smob != + // Old GCC versions get their type lattice for pointers-to-members + // tangled up to a degree where we need to typecast _both_ covariant + // types in order to be able to compare them. The other comparisons + // are for static member functions and thus are ordinary function + // pointers which work without those contortions. + if (static_cast(&Super::mark_smob) != static_cast(&Smob_base::mark_smob)) scm_set_smob_mark (smob_tag_, Super::mark_trampoline); scm_set_smob_print (smob_tag_, Super::print_trampoline); -- 2.39.5