https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109678
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Jason Merrill <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:4b8d0d4d7fd245ef85c7801e7838845502a5a61d commit r14-409-g4b8d0d4d7fd245ef85c7801e7838845502a5a61d Author: Jason Merrill <ja...@redhat.com> Date: Mon May 1 17:41:44 2023 -0400 c++: std::variant slow to compile [PR109678] Here, when dealing with a class with a complex subobject structure, we would try and fail to find the relevant FIELD_DECL for an empty base before giving up. And we would do this at each level, in a combinatorially problematic way. Instead, we should check for an empty base first. PR c++/109678 gcc/cp/ChangeLog: * constexpr.cc (cxx_fold_indirect_ref_1): Handle empty base first. gcc/testsuite/ChangeLog: * g++.dg/cpp1z/variant1.C: New test.