From mboxrd@z Thu Jan 1 00:00:00 1970 From: nathan@gcc.gnu.org To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org Subject: Re: c++/2910 Date: Mon, 28 May 2001 04:36:00 -0000 Message-id: <20010528113602.22834.qmail@sourceware.cygnus.com> X-SW-Source: 2001-05/msg00942.html List-Id: The following reply was made to PR c++/2910; it has been noted by GNATS. From: nathan@gcc.gnu.org To: Christoph.Pesch@web.de, gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org Cc: Subject: Re: c++/2910 Date: 28 May 2001 11:29:55 -0000 Synopsis: dynamic_cast seems to lose or change information State-Changed-From-To: analyzed->closed State-Changed-By: nathan State-Changed-When: Mon May 28 04:29:54 2001 State-Changed-Why: further email from originator points out this invokes undefined effects. specifically we bind a temporary to a reference, and then the temporary goes out of scope. The dynamic cast version fails, as they dynamic cast is implemented by a function call which clobbers the memory of that temporary. The static cast case does not fail, because memory happens to have the right things in it. http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=2910&database=gcc