https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86320
Ulya <skvadrik at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|very long compilatio n |very long compilation time | |for | |std::array<std::pair<int, | |int>, 1024 * 1024> --- Comment #1 from Ulya <skvadrik at gmail dot com> --- Compilation takes very long time for an array of tuples. Time depends on the length of an array. Clang doesn't seem to have this problem. // 1.cpp #include <array> #include <utility> void foo () { std::array<std::pair<int, int>, 1024 * 1024> arr {}; } $ time g++ --std=c++11 -c 1.cpp real 0m48.344s user 0m45.545s sys 0m2.306s $ time clang++ --std=c++11 -c 1.cpp real 0m0.540s user 0m0.322s sys 0m0.030s A quick check shows that previous GCC version are affected as well: https://godbolt.org/g/s3yudL the previous GCC versions Finally, this the following program with a user-defined 'pair' type compiles fast: #include <array> template <typename T, typename U> struct pair { T t; U u; }; void foo () { std::array<pair<int, int>, 1024 * 1024> arr {}; } $ time g++ --std=c++11 -c 1.cpp real 0m0.172s user 0m0.159s sys 0m0.011s