// Tested with 4.1.1 and 4.2.0-alpha20060520 //------------------------------------------------------------------------------ // Simple compile time assertion facility to check the identity of two types // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
template<typename X, typename Y> struct same { enum { n = -1 }; }; template<typename X> struct same<X,X> { enum { n = 1 }; }; #define ASSERT_DIFFERENT_TYPE(x,y) ASSERT_DIFFERENT_TYPE_IMPL_I(__LINE__,x,y) #define ASSERT_DIFFERENT_TYPE_IMPL_I(i,x,y) ASSERT_DIFFERENT_TYPE_IMPL_II(i,x,y) #define ASSERT_DIFFERENT_TYPE_IMPL_II(i,x,y) \ bool ASSERTION_FAILED_IN_LINE_ ## i [ - ::same<x,y>::n ] //------------------------------------------------------------------------------ // The problem // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ASSERT_DIFFERENT_TYPE(void(*)(),void(__attribute((stdcall)) *)()); // OK class X; ASSERT_DIFFERENT_TYPE(void(X::*)(),void(__attribute((stdcall)) X::*)()); // FAIL -- Summary: CC attributes not encoded in member function pointer Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: tschwinger at neoscientists dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29328