On Thu, Mar 18, 2021 at 05:20:54PM -0400, Jason Merrill wrote:
> On 3/9/21 10:31 AM, Jakub Jelinek wrote:
> > Hi!
> > 
> > My PR82304/PR95307 fix moved reinterpret cast from pointer to integer
> > diagnostics from cxx_eval_outermost_constant_expr where it caught
> > invalid code only at the outermost level down into
> > cxx_eval_constant_expression.
> > Unfortunately, it regressed following testcase, we emit worse code
> > including dynamic initialization of some vars.
> > While the initializers are not constant expressions due to the
> > reinterpret_cast in there, there is no reason not to fold them as an
> > optimization.
> > 
> > I've tried to make this dependent on !ctx->quiet, but that regressed
> > two further tests, so this patch bases that on manifestly_const_eval.
> 
> Did you try using ctx->strict?

Tried that now, it seems to be even worse than the original && !ctx->quiet
approach, regresses:
FAIL: g++.dg/cpp0x/constexpr-95307.C  -std=c++11  (test for errors, line 5)
FAIL: g++.dg/cpp0x/constexpr-95307.C  -std=c++14  (test for errors, line 5)
FAIL: g++.dg/cpp0x/constexpr-95307.C  -std=c++17  (test for errors, line 5)
FAIL: g++.dg/cpp0x/constexpr-95307.C  -std=c++2a  (test for errors, line 5)
FAIL: g++.dg/cpp0x/constexpr-ex1.C  -std=c++11  (test for errors, line 73)
FAIL: g++.dg/cpp0x/constexpr-ex1.C  -std=c++14  (test for errors, line 73)
FAIL: g++.dg/cpp0x/constexpr-ex1.C  -std=c++17  (test for errors, line 73)
FAIL: g++.dg/cpp0x/constexpr-ex1.C  -std=c++2a  (test for errors, line 73)
FAIL: g++.dg/cpp1y/constexpr-82304.C  -std=c++14  (test for errors, line 9)
FAIL: g++.dg/cpp1y/constexpr-82304.C  -std=c++17  (test for errors, line 9)
FAIL: g++.dg/cpp1y/constexpr-82304.C  -std=c++2a  (test for errors, line 9)
FAIL: g++.dg/cpp1y/constexpr-shift1.C  -std=c++14  (test for errors, line 6)
FAIL: g++.dg/cpp1y/constexpr-shift1.C  -std=c++14 (test for excess errors)
FAIL: g++.dg/cpp1y/constexpr-shift1.C  -std=c++17  (test for errors, line 6)
FAIL: g++.dg/cpp1y/constexpr-shift1.C  -std=c++17 (test for excess errors)
FAIL: g++.dg/cpp1y/constexpr-shift1.C  -std=c++2a  (test for errors, line 6)
FAIL: g++.dg/cpp1y/constexpr-shift1.C  -std=c++2a (test for excess errors)

        Jakub

Reply via email to