This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/41703] Problems with SFINAE. Source works at gcc 3.4.6 but fails at 4.2.1 and 4.5.0.20091008
- From: "redi at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Oct 2009 09:10:59 -0000
- Subject: [Bug c++/41703] Problems with SFINAE. Source works at gcc 3.4.6 but fails at 4.2.1 and 4.5.0.20091008
- References: <bug-41703-18315@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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