Hi, I found a small bug in the VC7.1 compiler, the code is not valid, but
the compiler hit ICE. Here is a small example

#include <iostream>
#include <map>

struct foo {
virtual int someVirtualFunc (int n)
{
return n;
}
};

template <class A, int (A::*func) (int)>
struct bar : public A {
bar ()
{
this->*func = &bar<A,func>::anotherVirtualFunc;
}

virtual int anotherVirtualFunc (int n)
{
return n;
}

};

int main ()
{
bar <foo, &foo::someVirtualFunc> aa;
return 0;
}

Lucas/

Re: very small bug in VC 7.1 by David

David
Sun Dec 14 15:41:39 CST 2003

>Hi, I found a small bug in the VC7.1 compiler, the code is not valid, but
>the compiler hit ICE. Here is a small example

Lucas,

I hope you'll be pleased to know that it doesn't ICE with the alpha
version of the Whidbey compiler. Instead it produces this error:

error C2659: '=' : overloaded function as left operand

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq

Re: very small bug in VC 7.1 by Carl

Carl
Sun Dec 14 18:31:05 CST 2003

This is a multi-part message in MIME format.

------=_NextPart_000_005A_01C3C25F.AB8D1F20
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Lucas Galfaso wrote:
> Hi, I found a small bug in the VC7.1 compiler, the code is not valid,
> but the compiler hit ICE. Here is a small example

The code is not valid according to the C++ standard. To quote Comeau:

Comeau C/C++ 4.3.3 (Aug 6 2003 15:13:37) for ONLINE_EVALUATION_BETA1
Copyright 1988-2003 Comeau Computing. All rights reserved.
MODE:strict errors C++

"ComeauTest.c", line 15: error: a pointer to a bound function may only =
be used to
call the function
this->*func =3D &bar<A,func>::anotherVirtualFunc;
^
detected during instantiation of "bar<A, func>::bar() [with =
A=3Dfoo,
func=3D&foo::someVirtualFunc]" at line 27

1 error detected in the compilation of "ComeauTest.c".


-cd

------=_NextPart_000_005A_01C3C25F.AB8D1F20
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Lucas Galfaso wrote:<BR>&gt; Hi, I =
found a small=20
bug in the VC7.1 compiler, the code is not valid,<BR>&gt; but the =
compiler hit=20
ICE. Here is a small example</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The code is not valid according to the =
C++=20
standard.&nbsp; To quote Comeau:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV><PRE><FONT =
face=3D"Lucida Console" size=3D2>Comeau C/C++ 4.3.3 (Aug 6 2003 =
15:13:37) for ONLINE_EVALUATION_BETA1
Copyright 1988-2003 Comeau Computing. All rights reserved.
MODE:strict errors C++

"ComeauTest.c", line 15: error: a pointer to a bound function may only =
be used to
call the function
this-&gt;*func =3D &amp;bar&lt;A,func&gt;::anotherVirtualFunc;
^
detected during instantiation of "bar&lt;A, func&gt;::bar() =
[with A=3Dfoo,
func=3D&amp;foo::someVirtualFunc]" at line 27

1 error detected in the compilation of "ComeauTest.c".
</FONT></PRE>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial =
size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>-cd</FONT></DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_005A_01C3C25F.AB8D1F20--


Re: very small bug in VC 7.1 by Lucas

Lucas
Mon Dec 15 10:00:17 CST 2003

Hi, I do know the code is invalid (that why I said it is a VERY SMALL BUG)
the bug is that the compiler ICE.

Lucas/
"Carl Daniel [VC++ MVP]" <cpdaniel_remove_this_and_nospam@mvps.org.nospam>
wrote in message news:%239Kl8KqwDHA.2556@TK2MSFTNGP10.phx.gbl...
Lucas Galfaso wrote:
> Hi, I found a small bug in the VC7.1 compiler, the code is not valid,
> but the compiler hit ICE. Here is a small example

The code is not valid according to the C++ standard. To quote Comeau:

Comeau C/C++ 4.3.3 (Aug 6 2003 15:13:37) for ONLINE_EVALUATION_BETA1
Copyright 1988-2003 Comeau Computing. All rights reserved.
MODE:strict errors C++

"ComeauTest.c", line 15: error: a pointer to a bound function may only be
used to
call the function
this->*func = &bar<A,func>::anotherVirtualFunc;
^
detected during instantiation of "bar<A, func>::bar() [with A=foo,
func=&foo::someVirtualFunc]" at line 27

1 error detected in the compilation of "ComeauTest.c".



-cd



Re: very small bug in VC 7.1 by Carl

Carl
Mon Dec 15 21:20:49 CST 2003

Lucas Galfaso wrote:
> Hi, I do know the code is invalid (that why I said it is a VERY SMALL
> BUG) the bug is that the compiler ICE.

D'oh! Sorry, I misread your posst as saying "the code is valid"... My bad.

-cd