https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96197
--- Comment #3 from rguenther at suse dot de <rguenther at suse dot de> --- On Wed, 15 Jul 2020, hyena at hyena dot net.ee wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96197 > > --- Comment #2 from Erich Erstu <hyena at hyena dot net.ee> --- > Richard Biener, you were right. I optimized the implementation of all the > problematic constant expression functions similarly to the one seen below, and > the compilation time went down to practically zero with unnoticeable memory > consumption. This is simple enough workaround that I can actually put into use > for real. constexpr shouldn't be an excuse for using slow algorithms - the compiler after all doesn't have magic ability just because you write 'constexpr' ;) In fact it's a lot slower in practice (and as you can see memory hungry though that's arguably a bug) - I guess at some point C++ compilers will have JITs just to make constexpr compile-times bearable because people are getting lazy with their algorithms... :/ I'm leaving the bug open for the memory consumption issue.