On Wed, Mar 06, 2019 at 06:21:11AM -0800, Belloc wrote:
> This seems to be a defect in the Standard, as every time a code exercises
> its right to use the fact that a default member initializer is a
> complete-class context, as stated in [class.mem]/(6.5)
> <
http://eel.is/c++draft/class.mem#6.5>, it will end up showing undefined
> behavior, according to this answer
> <
https://stackoverflow.com/a/55009966/1162978> in Stackoverflow.
You mainly need the complete-class context to allow name lookup in the
complete class, e.g.
struct A
{
int i = val;
static const int val = 1;
};
> That is,
> when a default member initializer tries to access another member down the
> class *member-specififcation
> <
http://eel.is/c++draft/class.mem#nt:member-specification>*, the code will
> show undefined behavior, as the accessed member is uninitialized at that
> point in time.
which is a different problem.
Christof
--
http://cmeerw.org sip:cmeerw at
cmeerw.org
mailto:
cmeerw at
cmeerw.org xmpp:cmeerw at
cmeerw.org