> On 07/02/2014 01:18 PM, Jan Hubicka wrote: > >We propagate types from places we know instances are created across pointers > >passed to functions. Once non-POD type is created at a given memory > >location, > >one can not change its type by placement_new into something else. > > Hmm. If the memory location is untyped (i.e. from malloc) or a > character array, or a union, you can indeed destroy an object of one > type and create an object of a different type in that location. > > >Jason, this assumes that one can not destroy the type and re-construct same > >type at the same spot. > > That is an invalid assumption; you can destroy one object and > construct a new one in the same location. Doing it within a method > would be unusual, but I don't think there's a rule against it.
The types get currently are one comming from declarations of variables and parameters passed by reference. Can I really destroy it/allocate new type/destroy new type/allocate back the original type (or terminate the program) so the destruction at the end of the lifetimate of the variable apsses? I suppose we should keep track if memory location is comming from declaration or it is dynamically typed (i.e. type seen from calling constructor)? Currently we don't deal with dynamic types, but I have patches for that. Honza > > Jason