c++: std::variant slow to compile [PR109678]
commit4b8d0d4d7fd245ef85c7801e7838845502a5a61d
authorJason Merrill <jason@redhat.com>
Mon, 1 May 2023 21:41:44 +0000 (1 17:41 -0400)
committerJason Merrill <jason@redhat.com>
Tue, 2 May 2023 20:24:15 +0000 (2 16:24 -0400)
treeee8437c91f6467f278d48bb59a956ae1ce330b9f
parentbc24c51c0ccd64617864897ad071c98004ffc0a4
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.
gcc/cp/constexpr.cc
gcc/testsuite/g++.dg/cpp1z/variant1.C [new file with mode: 0644]