C++ Logo

sg12

Advanced search

Re: [ub] type punning through congruent base class?

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Thu, 16 Jan 2014 22:04:24 +0200
On 16 January 2014 21:50, Herb Sutter <hsutter_at_[hidden]> wrote:
>> Well, as far as I understand, trivial constructors might not be called at all.
>
> Maybe "might not be called" is part of the bug then. Isn't the right model that trivial ctors are called, but "might do nothing"?


Maybe. I don't know how to word it right so that we say that
constructors are conceptually
called. I suppose you're heading to the right direction in the sense
that such wording
should clarify the situation so that you need to construct an object
to start its lifetime,
mere reference/pointer cast won't do. I don't know how this would interact with
suitably aligned buffers and standard-layout types. Perhaps it
interacts with the way
we want, so that just allocating a bag of chars won't begin the
lifetime of whatever
type that would fit into that bag. I also don't know whether this idea
has any impact
on the bane of my existence, aka unions.

Received on 2014-01-16 21:04:25