This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: bug in egcs-1.1b
- To: rssh at grad dot kiev dot ua, egcs at cygnus dot com
- Subject: Re: bug in egcs-1.1b
- From: Ben Scherrey <scherrey at gte dot net>
- Date: Tue, 13 Oct 1998 06:53:13 -0400
- Organization: Proteus Technologies, Inc.
- References: <36225E75.D8497015@Shevchenko.Kiev.UA>
- Reply-To: scherrey at proteus-tech dot com
That's really weird behavior. There's gotta be some quirk in dealing
with a stack-based variable or something because when I rewrite
check_dynamic_cast() as follows:
int check_dynamic_cast( void )
{
X* x = new X;
Y* Test = dynamic_cast< Y* >( x );
}
Everything works fine. I've found some strange behavior with
STL::iterators that seemingly identically semantic code will break when
typed one way and work when done another. I'm sure this is unrelated but
it does lead me to second guess the compiler when I get an unusual error
message. Of course, its usually me that's wrong...
regards,
Ben Scherrey
Ruslan Shevchenko wrote:
>
> When I try to compile next code:
> struct X { virtual int z() { return 1; } };
> struct Y:public X { virtual int z() { return 2; } };
> int check_dynamic_cast() { X x; return dynamic_cast<Y*>(&x)!=0; }
> int main() { return check_dynamic_cast(); }
>
> I receive next output:
> goblin:$ gcc t1.cpp 2>&1
> t1.cpp:3: sorry, not implemented: `addr_expr' not supported by dump_decl
> t1.cpp: In function `int check_dynamic_cast()':
> t1.cpp:3: warning: dynamic_cast of `' to `struct Y *' can never succeed
> goblin:$
>
> and t1.o not prodused.
>
> Is this a known bug ?