https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98604
Bug ID: 98604 Summary: Passing constexpr by const reference causes excessive memory usage during compilation Product: gcc Version: 9.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: adamkzyzik at gmail dot com Target Milestone: --- Created attachment 49922 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49922&action=edit code https://stackoverflow.com/questions/65621617/huge-memory-consumption-during-compilation-when-passing-constexpr-by-const-refer Seems like passing constexpr object to a constexpr constructor by const reference causes excessive memory footprint during compilation. The more that object is used in the constructor, the more memory is consumed. g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 I tested it on few other versions and the behavior was the same. It doesn't occur on clang-10.