When storage for an object with automatic or dynamic storage duration
is obtained, the object has an indeterminate value, and if
no initialization is performed for the object, that object retains an
indeterminate value until that value is replaced ([expr.ass]).
If an indeterminate value of
unsigned ordinary character type ([basic.fundamental])
or std::byte type ([cstddef.syn])
is produced by the evaluation of:
If an indeterminate value of
unsigned ordinary character type or std::byte type
is produced by the evaluation of
the right operand of a simple assignment operator ([expr.ass])
whose first operand is an lvalue of
unsigned ordinary character type or std::byte type,
an indeterminate value replaces
the value of the object referred to by the left operand.
If an indeterminate value of unsigned ordinary character type
is produced by the evaluation of the initialization expression
when initializing an object of unsigned ordinary character type,
that object is initialized to an indeterminate
value.
If an indeterminate value of
unsigned ordinary character type or std::byte type
is produced by the evaluation of the initialization expression
when initializing an object of std::byte type,
that object is initialized to an indeterminate value.
int f(bool b){unsignedchar c;
unsignedchar d = c; // OK, d has an indeterminate valueint e = d; // undefined behaviorreturn b ? d :0; // undefined behavior if b is true}