This is the mail archive of the gcc@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: bug in egcs-1.1b


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 ?


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