This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

compiler error


When compiling the test2.cc program (see attachment), the following
error occurred:

DOWNLOAD/AVLTREE/AvlTrees/TEST > g++ test2.cc
test2.cc: In method `void Link::setLink(class Link *)':
test2.cc:32: Internal compiler error.
test2.cc:32: Please submit a full bug report to `egcs-bugs@cygnus.com'.
DOWNLOAD/AVLTREE/AvlTrees/TEST > 

I think my code is wrong, but it should not result in a compiler error.

Thanks (if you want to look at it),

Johannes







P.S. 
The compiler version is:
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/specs
gcc version egcs-2.90.27 980315 (egcs-1.0.2 release)
#include <stdio.h>

void aap(int x,int y)
{
};

int noot(int x,int y)
{
    return 10;
};

class Link 
{

//    typedef void (*mytype)(void);
    public:
	Link *next;

	Link()
	{ next = (Link *) 0;
          printf("hallo \n");
          hallo=&aap1;
	}

	Link(int a)
	{ next = (Link *) 0;
          printf("integer: %d \n",a);}

	void setLink(Link *n)
	{ 
	   next = n;
	   this->hallo();
	}

	void add(Link *n)
	{ if (next) next->add(n); else setLink(n); }
	
	void onEachDo(void f(Link *))
	{ f(this); if (next) next->onEachDo(f); }
    
 	virtual print()
        { printf("HALLO....\n"); }

	void aap1()
	{}

	static void display(Link *x)
	{ x->print(); }

//	mytype hallo;
	void (Link::*hallo)(void);
}; 

class LinkedList 
{
    public:
	Link *elements;

	LinkedList()
	{ elements = (Link *) 0; }

	void add(Link *n)
	{ if (elements) elements->add(n); else elements = n; }
	
	void onEachDo(void f(Link *))
	{ if (elements) elements->onEachDo(f); }
}; 

// void (*hallo)(void);

class IntegerLink: public Link
{
    int value;

    public:
	IntegerLink(int i) : Link()
	{ value = i; }

    print()
    { printf("%d\n", value); }
};

main()
{
    void (*hop)(int,int) = aap;

    Link	hallo1;
    Link	daar(10);

    LinkedList list;

    IntegerLink *list1;
    Link        *list2;

    list2 = list1;

    list.add(new IntegerLink(3));
    list.add(new IntegerLink(17));
    list.add(new IntegerLink(32));

    list.onEachDo(Link::display);
    noot(10,11);
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]