c++/5144: ICE on const_hash
gcurran@gte.net
gcurran@gte.net
Mon Dec 17 17:06:00 GMT 2001
>Number: 5144
>Category: c++
>Synopsis: ICE on const_hash
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: ice-on-legal-code
>Submitter-Id: net
>Arrival-Date: Mon Dec 17 17:06:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: George Curran
>Release: gcc version 2.95.2 19991024 (release)
>Organization:
>Environment:
Suse Linux ver 7.1
pentium 300Mhz, 96M ram
>Description:
viffer@linux:~/cpp.21days > c++ lst14.11.cpp -o example
lst14.11.cpp: In function `int main(...)':
lst14.11.cpp:30: Internal compiler error in `const_hash', at varasm.c:2372
Please submit a full bug report.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
attempting to compile program 14.11 in "Teach Yourself C++ Programming in 21 Days" by
Jesse Liberty. Sams Publishing
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="lst14.11.cpp"
Content-Disposition: inline; filename="lst14.11.cpp"
// listing 14.11 array of pointers to member functions
#include<iostream.h>
enum BOOL {FALSE, TRUE};
class Dog
{
public:
void Speak() const {cout << "Woof!\n";}
void Move() const {cout << "Walking to heel. . .\n";}
void Eat() const {cout << "Gobbling food. . .\n";}
void Growl() const {cout << "Grrrr!\n";}
void Whimper() const {cout << "Whining noises. . .\n";}
void RollOver() const {cout << "Rolling over. . .\n";}
void PlayDead() const {cout << "Is this the end of Little Caeser?\n";}
};
typedef void (Dog::*PDF)()const ;
void main()
{
const int MaxFuncs = 7;
PDF DogFunctions[MaxFuncs] =
{ &Dog::Speak,
&Dog::Move,
&Dog::Eat,
&Dog::Growl,
&Dog::Whimper,
&Dog::RollOver,
&Dog::PlayDead};
Dog* pDog =0;
int Method;
BOOL fQuit = FALSE;
while (!fQuit)
{
cout << "(0)Quit (1)Speak (2)Move (3)Eat (4)Growl";
cout << "(5)Whimper (6)Roll Over (7)Play Dead: ";
cin >> Method
if (Method == 0)
{
fQuit = TRUE;
break;
}
else
{
pDog = new Dog;
(pDog->*DogFunctions[Method-1])();
delete pDog;
}
}
}
More information about the Gcc-prs
mailing list