On Thursday, 28 October 2021 at 14:49:41 UTC, Paul Backus wrote:
>According to the current language spec, the entire program has undefined behavior whether or not the result contains pointers. Walter has proposed to change this 1, but the proposal has not been accepted.
Some other change has been made to the spec after that PR was made. It currently reads:
>- Implementation Defined: If a void initialized variable's value is used before it is set, its value is implementation defined.
void bad()
{
int x = void;
writeln(x); // print implementation defined value
}
> - Undefined Behavior: If a void initialized variable's value is used before it is set, and the value is a reference, pointer or an instance of a struct with an invariant, the behavior is undefined.
void muchWorse()
{
char[] p = void;
writeln(p); // may result in apocalypse
}