[Bug c++/21279] static Derived-to-Base cast fails when ~Derived has run.

jason at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Mar 3 20:22:00 GMT 2006



------- Comment #5 from jason at gcc dot gnu dot org  2006-03-03 20:21 -------
3.8     Object Lifetime    [basic.life]
...
Before the lifetime of an object has started but after the storage which the
object will occupy has been allocated or, after the lifetime of an object has
ended and before the storage which the object occupied is reused or released,
any pointer that refers to the storage location where the object will be or was
located may be used but only in limited ways.
...
If the object will be or was of a non-POD class type, the program has undefined
behavior if:
...
      -- the pointer is implicitly converted (4.10) to a pointer to a base
class type, or
      -- the pointer is used as the operand of a static_cast (5.2.9) (except
when the conversion is to void*, or to void* and subsequently to char*, or
unsigned char* ).


-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21279



More information about the Gcc-bugs mailing list