c++: Fix rejects-valid bug in cxx_eval_outermost_constant_expr [PR93905]
commitf4335f978249a2991620f38e118adf790e677968
authorJakub Jelinek <jakub@redhat.com>
Wed, 26 Feb 2020 08:02:05 +0000 (26 09:02 +0100)
committerJakub Jelinek <jakub@redhat.com>
Wed, 26 Feb 2020 08:02:05 +0000 (26 09:02 +0100)
tree1556b4ba084748466bc575991af9c141bd82a7c1
parentf52ec6bc163af837cd13e234b7c2eab6bc456e12
c++: Fix rejects-valid bug in cxx_eval_outermost_constant_expr [PR93905]

The following testcase is rejected in 8.3, but was accepted in 8.2 and
is in 9.x.  This started with my PR87934
* constexpr.c (cxx_eval_constant_expression) <case CONSTRUCTOR>: Do
re-process TREE_CONSTANT CONSTRUCTORs if they aren't reduced constant
expressions.
backport, where the NSDMI CONSTRUCTOR that contains CONST_DECLs is now
constexpr evaluated so that it doesn't contain them.  The difference from
9.x is that 9.x doesn't call get_target_expr if we got a CONSTRUCTOR for a
class type for something that has been originally a CONSTRUCTOR too.

This patch cherry-picks just that hunk of the r9-3835 change.

2020-02-26  Jakub Jelinek  <jakub@redhat.com>

PR c++/93905
Backported from mainline
2018-11-04  Jason Merrill  <jason@redhat.com>

* constexpr.c (cxx_eval_outermost_constant_expr): Don't wrap a
CONSTRUCTOR if one was passed in.

* g++.dg/cpp0x/pr93905.C: New test.
gcc/cp/ChangeLog
gcc/cp/constexpr.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/pr93905.C [new file with mode: 0644]