| ▲ | baobun 5 hours ago | |
> The original code defined a struct with two bools that were not initialized. Therefore, when you instantiate one, the initial values of the two bools could be anything. In particular, they could be both true. Then reading from that struct like in OP constitutes UB. | ||
| ▲ | yongjik 5 hours ago | parent [-] | |
Well yes, that would be UB, but even if the C++ compiler had no concept of UB, it would still be wrong code. | ||