bug-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

compiler bug report


From: Tchernykh, Alexandre
Subject: compiler bug report
Date: Thu, 5 Dec 2002 17:11:11 -0500

Hi there,

I got a internal compile error:

jupiter% c++ abstract_class_inheriting.c
abstract_class_inheriting.c: In function `int main(...)':
abstract_class_inheriting.c:86: Internal compiler error.
abstract_class_inheriting.c:86: Please submit a full bug report to
address@hidden'.


jupiter% c++ -v
Reading specs from /usr/swlocal/lib/gcc-lib/sparc-sun-solaris2.7/2.8.1/specs
gcc version 2.8.1

the code I compiled:

#include <iostream>

class mem_access
{
private:
  int private_addr;
protected:
  int protected_addr;
public:
  int public_addr;
  int (mem_access::*func)(void);
  mem_access()
     {
       private_addr = 666;
       protected_addr = 666;
       func = &mem_access::get;
       std::cout<< "  mem_access : Default Constructor ptr ="<<this<<"\n";
     };
  mem_access(int addr_) : private_addr(addr_) {std::cout<< "  mem_access :
Constructor ptr ="<<this<<"\n";};
  void write(int value) { private_addr = value;};
  virtual int get() = 0;
  void set(int addr) { private_addr = addr;};
};

class tx : public  mem_access
{
public:
  int (tx::*func)(void);

  tx(int addr=0) : mem_access(addr)
     {
       protected_addr = 33;
       func = &tx::get;
       std::cout<< "  tx : Constructor ptr ="<<this<<"\n";
     };
  int get() { return protected_addr;};
};

class rx : public  mem_access
{
public:
  rx(int addr) : mem_access(addr)
     {
       set(addr);
       protected_addr = 44;
       std::cout<< "  rx : Constructor ptr ="<<this<<"\n";
     };
  int get() { return protected_addr;};
};
class apache : public tx, public rx
{
public:
  apache() : tx(4), rx(3) { std::cout<< "  apache : Constructor ptr
="<<this<<"\n";};

};
void main()
{
  tx tx1(1);
  std::cout<< " tx addr = "<<tx1.get()<<'\n';
  rx rx1(1);
  std::cout<< " rx addr = "<<rx1.get()<<'\n';
  std::cout<< " tx addr = "<<tx1.get()<<'\n';

  std::cout<< "\t main : CONSTRUCTORS ORDER TEST \n";
  apache ap1;
  std::cout<< "\t main : CONSTRUCTORS ORDER Test Completed \n";
  std::cout<< " tx addr = "<<ap1.tx::get()<<'\n';
  std::cout<< " rx addr = "<<ap1.rx::get()<<'\n';

  std::cout<< " rx addr = "<<ap1.rx::public_addr<<'\n';

  std::cout<< " pp = "<<(unsigned int)&pp<<'\n';
  std::cout<< " pp1 = "<<(unsigned int)&pp1<<'\n';
  std::cout<< " tx.get address = "<<(unsigned int)ap1.tx::get<<'\n';
  std::cout<< " rx.get address = "<<(unsigned int)ap1.rx::get<<'\n';
  ap1.tx::func();
}


Best regards,

 ____________________________________
  Alexandre Tchernykh
  Sr Software Engineer
  Marconi Communications
  1125 Innovation Drive
  KANATA, Ontario, Canada   K2K 3G6

  Tel: 613-2715546
  Fax: 613-2715500






reply via email to

[Prev in Thread] Current Thread [Next in Thread]