You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From https://stackoverflow.com/questions/59442521/use-of-variable-in-own-initializer
After the resolution of CWG2256¹ changed the rules of an object lifetime start, unsigned char x = x; no longer initializes x with its own indeterminate value as the Example in [basic.scope.pdecl]/1 says, but triggers undefined behavior, because the initializer accesses the object whose lifetime has not started yet (because variable initialization hasn't completed).
Which, if ignore references, kinda mixes variables with objects…
The text was updated successfully, but these errors were encountered:
So, the definition of "vacuous initialization" has changed, and that means "unsigned char x = x" no longer has vacuous initialization, thus the glvalue "x" is used to access an object whose lifetime has not yet begun, which is undefined behavior. If that's unintended (is it?), that doesn't seem to be editorial at all to me.
If the change in semantics here is intended, fixing the example is indeed editorial.
From https://stackoverflow.com/questions/59442521/use-of-variable-in-own-initializer
After the resolution of CWG2256¹ changed the rules of an object lifetime start,
unsigned char x = x;
no longer initializesx
with its own indeterminate value as the Example in [basic.scope.pdecl]/1 says, but triggers undefined behavior, because the initializer accesses the object whose lifetime has not started yet (because variable initialization hasn't completed).The text was updated successfully, but these errors were encountered: