PDA

View Full Version : Hi, can somebody with Intel compilator test that code ?


Manao
11th February 2004, 08:13
This code compiles with gcc, but not with VC++ 7.0.

I wanted to know if it was a bug of VC++ or something else :


typedef bool (*Compare)(int x, int y);
struct A
{
int a;
int b;

template <Compare C>
int c()
{
return C(a,b) ? a : b;
}
};

bool lt(int x, int y)
{ return x < y; }
bool gt(int x, int y)
{ return x > y; }


typedef int (A::*ACompare)();
int main()
{
A untest;
untest.c<lt>();
ACompare f1 = &A::c<lt>;
ACompare f2 = &A::c<gt>;
}


The aim of that code it to test whether it can use pointers on member's function which are templates.

Nic
11th February 2004, 11:19
Compiles fine under Intel Compiler 8, doesn't work with Visual C++ 6's normal compiler though.

edit:
(lol, if you // untest.c<lt>(); and then try and compile in VC6, you get a "INTERNAL COMPILER ERROR"... ;) )

Manao
11th February 2004, 12:13
Damn, that's what I thought. At least, it's not my fault then. Thanks a lot, I'll try to do it by another way.

gabest
12th February 2004, 21:54
vc71 likes it, no ICE either

Manao
12th February 2004, 22:02
Argh, I've got v7.0.9466. Let see how I can update the thing.

Thank you gabest !