https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91644
Bug ID: 91644
Summary: [C++20] constinit segfaults inside templated functions
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: [email protected]
Target Milestone: ---
Created attachment 46804
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46804&action=edit
constinit test cases
Hi.
Reading P1143R2 my understanding is that the constinit initialization should be
also possible inside a function scope. If I'm mistaken, it should be
diagnosted and rejected. Nonetheless, it currently segfaults the compiler, if
the function happens to be templated, so it needs some adjustment anyway:
template < typename T >
static void function() {
static __constinit auto value = 0;
}
Attached a few test cases.