https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71165
Aleksey Covacevice <aleksey.covacevice at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |aleksey.covacevice at gmail
dot co
| |m
--- Comment #3 from Aleksey Covacevice <aleksey.covacevice at gmail dot com> ---
I also confirm this. Also present in 5.4.0 and 6.1.0 (at least).
The following test case contains 3 scenarios, each one originated from
uncommenting the respective line in main():
#include <iostream>
using namespace std;
struct X {
X() { cerr << __func__ << endl; }
~X() { cerr << __func__ << endl; }
};
template<typename Type>
struct Object1 { Type Value; };
template<typename Type>
struct Object2 { Type Value{}; };
int main() {
//X object[0x1000]; // (1)
//Object1<X[0x1000]> object; // (2)
//Object2<X[0x1000]> object; // (3)
}
Scenarios (1) and (2) produce roughly the same executable, in either -O0 and
-Ofast. Scenario (3) takes an enormous time to compile, produces a much larger
executable, -Winline complains about not being able to inline things and, on
occasion, cc1plus crashes (specially if you raise the size of the arrays
involved).
Output (for scenario 3):
Test.c++: In function 'int main()':
Test.c++:14:8: warning: inlining failed in call to 'constexpr Object2<X
[4096]>::Object2() noexcept (false)': --param large-function-growth limit
reached [-Winline]
struct Object2 { Type Value{}; };
^
Test.c++:19:21: warning: called from here [-Winline]
Object2<X[0x1000]> object; // (3)