public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* bug in egcs-1.1b
@ 1998-10-12 14:32 Ruslan Shevchenko
  1998-10-13  3:55 ` Ben Scherrey
  1998-10-30  3:25 ` Alexandre Oliva
  0 siblings, 2 replies; 3+ messages in thread
From: Ruslan Shevchenko @ 1998-10-12 14:32 UTC (permalink / raw)
  To: egcs

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 ?


-- 
    @=                                   
     //RSSH                             
mailto:Ruslan@Shevchenko.Kiev.UA

CORBA in Ukraine & ex-USSR: http://www.corbadev.kiev.ua

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bug in egcs-1.1b
  1998-10-12 14:32 bug in egcs-1.1b Ruslan Shevchenko
@ 1998-10-13  3:55 ` Ben Scherrey
  1998-10-30  3:25 ` Alexandre Oliva
  1 sibling, 0 replies; 3+ messages in thread
From: Ben Scherrey @ 1998-10-13  3:55 UTC (permalink / raw)
  To: rssh, egcs

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 ?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bug in egcs-1.1b
  1998-10-12 14:32 bug in egcs-1.1b Ruslan Shevchenko
  1998-10-13  3:55 ` Ben Scherrey
@ 1998-10-30  3:25 ` Alexandre Oliva
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 1998-10-30  3:25 UTC (permalink / raw)
  To: rssh; +Cc: egcs

[-- Attachment #1: Type: text/plain, Size: 513 bytes --]

Ruslan Shevchenko <Ruslan@Shevchenko.Kiev.UA> writes:

> 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

Thanks for your bug report.  I have installed the attached test case
in the testsuite.

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:oliva@gnu.org mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil

[-- Attachment #2: dcast2.C --]
[-- Type: text/x-c++, Size: 268 bytes --]

// Build don't link:

// Based on a testcase by Ruslan Shevchenko <Ruslan@Shevchenko.Kiev.UA>

struct B {
  virtual ~B();
};

struct D : public B {
};

void foo() {
  B x;
  dynamic_cast<D*>(&x); // gets bogus error - XFAIL *-*-*
  B* p = &x;
  dynamic_cast<D*>(p);
}

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1998-10-30  3:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-10-12 14:32 bug in egcs-1.1b Ruslan Shevchenko
1998-10-13  3:55 ` Ben Scherrey
1998-10-30  3:25 ` Alexandre Oliva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).