Attempting to compiling the following code using gcc 4.5.2 with the
-std=c++0x option so I can use static_assert erroneously triggers a
static_assert "failure in TTest2". Is this a known bug ?
"struct AType
{
template<class X,class Y,class Z,short AA> double
SomeFuncTemplate(X,Y *,Z &) { double ret(AA); return ret; }
};
template
<
class T
>
struct TTest
{
typedef char Bad;
struct Good { char x[2]; };
template<T> struct helper;
static Good check(helper<&AType::template
SomeFuncTemplate<int,long,double,50> > *);
static Bad check(...);
static const bool value=sizeof(check(0))==sizeof(Good);
};
template
<
class T,
class C
>
struct TTest2
{
typedef char Bad;
struct Good { char x[2]; };
template<T> struct helper;
template<class U> static Good check(helper<&U::template
SomeFuncTemplate<int,long,double,50> > *);
template<class U> static Bad check(...);
static const bool value=sizeof(check<C>(0))==sizeof(Good);
};
int main()
{
static_assert(TTest
<
double (AType::*)(int,long *,double &)
>::value,
"failure in TTest"
);
static_assert(TTest2
<
double (AType::*)(int,long *,double &),
AType
>::value,
"failure in TTest2"
);
return 0;
}"