https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99170
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Nathan Sidwell <nat...@gcc.gnu.org>: https://gcc.gnu.org/g:c390c5df71bbc95627c8e5e649a3161091239fd9 commit r11-7495-gc390c5df71bbc95627c8e5e649a3161091239fd9 Author: Nathan Sidwell <nat...@acm.org> Date: Wed Mar 3 12:38:20 2021 -0800 c++: Defer cloning to post-loading [PR 99170] It turns out that cloning can cause use to load things. Specifically when checking paramter shadows (this is avoidable), and also the delete operator of a deleting dtor (not avoidable). Doing that in the middle of loading is a bad thing. This defers it to a post-load worklist. If it causes more loading at that point there is no problem, as we've completed the first set of loads, bar this bit of cleanup. Again, this doesn't fix 99170, but is a step towards a solution. PR c++/99170 gcc/cp/ * module.cc (post_load_decls): New. (lazy_snum, recursive_lazy): Move earlier. (module_state::read_cluster): Push cloning onto post_load_decls. (post_load_processing): New. Do the cloning here. (module_state::read_inits): Call post_load_processing. (module_state::read_language): Likewise. (lazy_load_binding, lazy_load_specializations): Likewise (lazy_load_members): Likewise