This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: egcs-971122 problem: typeid
- To: Joseph Heled <pepe at iconz dot co dot nz>, egcs-bugss <egcs-bugs at cygnus dot com>
- Subject: Re: egcs-971122 problem: typeid
- From: "Michael A. Benzinger" <mbenz at sabre dot com>
- Date: Wed, 26 Nov 1997 07:44:00 -0600
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