https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110028
Bug ID: 110028 Summary: slow compilation on incorrect namespace after gcc-12.1 Product: gcc Version: 12.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: stevenxia990430 at gmail dot com Target Milestone: --- The following program is very slow to compile (>10 seconds) and return error. Compared to clang (<1 second). To quickly reproduce: https://gcc.godbolt.org/z/Pfrxcdb9h ``` #include <span> #include <vector> namespace test { #include <algorithm> std::size_t filter_odd_elements(std::span<long> array) { std::size_t index = 0; std::copy_if(array.rbegin(), array.rend(), array.begin(), [&](long value) { return (++index) % 2 == 1; }); return index; } } int main() { } ``` Tested on Trunk and it seems that the slow compilation rate occured after and including gcc 12.1