https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122785
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I can reproduce it on #c0 though and the backtrace there is #0 error_at (loc=1084293, gmsgid=0x4df8ec4 "recursive lazy load") at ../../gcc/diagnostic-global-context.cc:645 #1 0x0000000000694385 in recursive_lazy (snum=4294967295) at ../../gcc/cp/module.cc:16579 #2 0x00000000006a7905 in lazy_load_pendings (decl=0x7fffe6a03460) at ../../gcc/cp/module.cc:22490 #3 0x000000000090adef in complete_type (type=0x7fffe6a06150) at ../../gcc/cp/typeck.cc:135 #4 0x00000000008774a9 in consteval_only_p (t=0x7fffe6a06150) at ../../gcc/cp/reflect.cc:8079 #5 0x0000000000554d39 in maybe_commonize_var (decl=0x7fffe6df9ab0) at ../../gcc/cp/decl.cc:7302 #6 0x00000000005af0bd in tentative_decl_linkage (decl=0x7fffe6df9ab0) at ../../gcc/cp/decl2.cc:3786 #7 0x0000000000684424 in (anonymous namespace)::trees_in::read_var_def (this=0x7fffffffb9a0, decl=0x7fffe6df9ab0, maybe_template=0x7fffe6dfda18) at ../../gcc/cp/module.cc:13281 #8 0x0000000000689bb7 in (anonymous namespace)::trees_in::read_definition (this=0x7fffffffb9a0, decl=0x7fffe6df9ab0) at ../../gcc/cp/module.cc:14100 #9 0x0000000000697ae8 in module_state::read_cluster (this=0x7fffe980f708, snum=1160) at ../../gcc/cp/module.cc:17627 #10 0x00000000006a391d in module_state::load_section (this=0x7fffe980f708, snum=1160, mslot=0x7fffe7582508) at ../../gcc/cp/module.cc:21450 #11 0x00000000006a7545 in module_state::lazy_load (this=0x7fffe980f708, index=2206, mslot=0x7fffe7582508) at ../../gcc/cp/module.cc:22404 I wonder if it wouldn't help to e.g. cache consteval_only_p in 2 bits on something, either in TYPE_LANG_SPECIFIC or in DECL_LANG_SPECIFIC or in both (unknown, consteval_only_p, !consteval_only_p) and stream those bits during module streaming out/in.
