This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ PATCH for c++/91644 - ICE with constinit in function template


On 9/4/19 3:06 PM, Marek Polacek wrote:
On Wed, Sep 04, 2019 at 04:00:24PM -0400, Jason Merrill wrote:
On 9/3/19 4:08 PM, Marek Polacek wrote:
First constinit bug report (yay?).  The problem is that while I made sure
that constinit variable templates work as they should, I clearly neglected
ordinary static variables declared constinit in function templates.

Hmm, right, locals don't get DECL_TEMPLATE_INFO.

And if I create a new, clear one, it crashes.  But I was able to work around
that by remembering if we saw constinit.

As an aside, I'm concerned that if we're required to handle
// Foo.h
struct Foo {
    constinit static int x;
};
// Foo.cpp
int Foo::x = 42;

we might need to resurrect DECL_DECLARED_CONSTINIT_P...

Or use an (internal) attribute?

Luckily it would appear that we won't be required to handle that case.

Any comments on the patch itself?

The patch is OK.

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]