This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Internal compiler error operator- and operator if
- To: <gcc-bugs at gcc dot gnu dot org>
- Subject: Internal compiler error operator- and operator if
- From: "Bas Vodde" <basv at medialab dot lostboys dot nl>
- Date: Mon, 18 Sep 2000 13:19:13 +0200
Hello,
On the following code I get an internal compiler error:
class CVerySimple
{
public:
CVerySimple (int inData) : mData (inData) {};
operator int () {return mData;}
CVerySimple operator - () const {return -mData;}
private:
int mData;
};
CVerySimple
Abs (CVerySimple inValue)
{
return (0 < inValue) ? inValue : -inValue;
}
void main ()
{
CVerySimple theInt = 2;
Abs (theInt);
}
I'm using gcc 2.95.2. If I rewrite the ? : operator to a normal if then it
compiles fine. Also when I remove the - in the result it compiles fine. When
I use -O1 then the internal compiler error is gone.
Compiler error:
Test.C: In function `class CVerySimple Abs<CVerySimple>(CVerySimple)':
Test.C:22: instantiated from here
Test.C:16: Internal compiler error in `instantiate_virtual_regs_1', at
function.c:3863
Bas
Bas Vodde
Software Developer
Lost Boys Medialab
www.medialab.lostboys.nl