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]

Re: egcs-971122 problem: typeid


Joseph,

Might this have something to do with the fact that in file 1 you
have declared "class X;" and in file 2 you have declared
"struct X ...".  I am not sure what the standard says on this
matter.  At any rate, have you tried printing out what the
typeid's of the two are.

Mike Benzinger

At 09:02 AM 11/26/97 +1300, Joseph Heled wrote:
>
>file 1
>--------------------------------------------
>#include <typeinfo>
>
>class X;
>
>bool f(X& x) {
>  return typeid(x) == typeid(X);
>}
>---------------------------------------------
>
>file 2
>--------------------------------------------
>struct X { virtual ~X() {} };
>
>struct Y : X {
>  virtual ~Y() {}
>};
>
>main()
>{
>  extern bool f(X& x);
>
>  Y y;
>  
>  if( f(y) ) {
>    printf("wrong\n");
>  } else {
>    printf("correct\n");
>  }    
>}
>---------------------------------------------

-------------------------------------------------------------
Michael A. Benzinger
Principal

SABRE Technology Solutions        Phone:  +1 817-264-6820
1 E. Kirkwood Blvd.               Fax:    +1 817-264-3504
Southlake, TX  76092              e-mail: mbenz@sabre.com
U.S.A.                                    bzinger@iName.com


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