If you make compile_object atomic and mask it in your second auto object, you can gather all the information you need during the actual compilation, and then throw an error (causing an atomic rollback) if you get information you don't like.