I'm not saying this is the best way to write this code - there are several reasons RAII is better. But in this case, "look how messy non-RAII code is!" isn't the reason.
The original example does actually properly deal with exceptions.
This code work with assertion that constructors of A and B will never throw !