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]

vtable1


Hallo,

I have written on the 01/06/98 a bug-report,

can nobody see the problem in the program(multiple inheritance in
relation with template-classes) ?

the output compiled with gcc-2.7.1:
 void xobj::f1()
void tBase::f()
void t<int>::c1() const:sizeof(T)=4
void tBase::f()
void t<char>::c1() const:sizeof(T)=1

and with egcs-1.xxx or gcc-2.8.0:
void xobj::f1()
void tBase::f()
void t<char>::c1() const:sizeof(T)=1
void tBase::f()
void t<char>::c1() const:sizeof(T)=1



include <stdio.h>

class xobj;
struct desc {
        xobj xobj::* mp;
};
extern desc tab[];

class xobj
{
public:
        virtual void f(){ printf("%s\n", __PRETTY_FUNCTION__); }
        void f1() {
                printf("%s\n", __PRETTY_FUNCTION__);
                ( & ( this ->* tab[ 0 ].mp ) ) ->f();
                ( & ( this ->* tab[ 1 ].mp ) ) ->f();
        }
};

class rBase
{
public:
        virtual void  c1() const = 0;
};

class tBase : public  xobj, rBase
{
        public:
        virtual void f(){
                tBase *q= this;
                printf("%s\n", __PRETTY_FUNCTION__);
                q->c1();
        }
};

template <class T>
class t : public tBase
{
public:
        virtual void c1() const
        {
                printf("%s:sizeof(T)=%d\n",
__PRETTY_FUNCTION__,sizeof(T));
        }
};

class msg : public xobj
{
  public:
        t<int> A;
        t<char> B;
};

desc tab[] = {
 { (xobj (xobj::*))&msg::A},
 { (xobj (xobj::*))&msg::B}
};

void main()
{
        msg  m;
        m.f1();
}





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