------- Comment #1 from redi at gcc dot gnu dot org 2009-10-14 09:10 ------- Slightly reduced:
template <typename T, int (T::*)() const> struct TSizeEnabler { typedef T TClass; }; template <typename X> int GetAllSize(const X &Var) { return sizeof(Var); } template <typename X> int GetAllSize(const typename TSizeEnabler<X, &X::func>::TClass &Var) { return Var.func(); } struct H { int func() const; }; int main() { H b; return GetAllSize< H >(b); } I think you're right that this is a bug. As a workaround you might be able to remove GetAllSize(const X &Var) from the overload set for the case when X::CalcMySize exists. -- redi at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jwakely dot gcc at gmail dot | |com Known to fail| |4.1.2 4.4.1 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41703