[Bug c++/41703] Problems with SFINAE. Source works at gcc 3.4.6 but fails at 4.2.1 and 4.5.0.20091008
redi at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Oct 14 09:11:00 GMT 2009
------- 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
More information about the Gcc-bugs
mailing list