Another thing – I sometimes see people arguing that violations of the API contracts of libraries (‘library UB’) should be distinguished from violations of invariants of the language itself (‘compiler UB’). While it's superficially appealing, I don't think it's going to help much.
In a sibling thread, there is a proposal to make File
values containing a negative file descriptor illegal, to help with ABI layout optimisations. If adopted, this proposal is going to escalate what previously was ‘merely’ ‘library UB’ into ‘compiler UB’, without really changing the library contract – since what constitutes a violation of the contract doesn't change, only the consequences thereof.
If libraries allowed to do that with impunity, then the distinction between ‘compiler’ and ‘library’ UB becomes moot. In the end, UB is UB, it doesn't really matter where it comes from.