Re: [C++ PATCH] Fix wrong-code on var construction in static init (PR c++/77907)

2016-11-23 Thread Jason Merrill
On Wed, Nov 23, 2016 at 11:36 AM, Jakub Jelinek wrote: > On Wed, Nov 23, 2016 at 10:42:57AM -0500, Jason Merrill wrote: >> OK, but I wonder why we don't do constant initialization of that variable... > > Dunno either, check_initializer simply returns the call to the constructor > for the var. I'v

Re: [C++ PATCH] Fix wrong-code on var construction in static init (PR c++/77907)

2016-11-23 Thread Jakub Jelinek
On Wed, Nov 23, 2016 at 10:42:57AM -0500, Jason Merrill wrote: > OK, but I wonder why we don't do constant initialization of that variable... Dunno either, check_initializer simply returns the call to the constructor for the var. I've tried something like: --- gcc/cp/decl.c.jj2016-11-21 19:4

Re: [C++ PATCH] Fix wrong-code on var construction in static init (PR c++/77907)

2016-11-23 Thread Jason Merrill
OK, but I wonder why we don't do constant initialization of that variable... On Wed, Nov 23, 2016 at 9:59 AM, Jakub Jelinek wrote: > Hi! > > During cp_fold, we see a call to constructor and because the ctor > is DECL_DECLARED_CONSTEXPR_P, when optimizing we call maybe_constant_value > on it. But

[C++ PATCH] Fix wrong-code on var construction in static init (PR c++/77907)

2016-11-23 Thread Jakub Jelinek
Hi! During cp_fold, we see a call to constructor and because the ctor is DECL_DECLARED_CONSTEXPR_P, when optimizing we call maybe_constant_value on it. But as when evaluating that we don't have an object, it returns the initializer of the var, rather than an assignment of the initializer to the v