https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109678
--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-13 branch has been updated by Jason Merrill <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:d3088f0ed25fe7200fd657b70cb5af53139b0193 commit r13-7713-gd3088f0ed25fe7200fd657b70cb5af53139b0193 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.