diff options
author | Jakub Jelinek <jakub@redhat.com> | 2019-12-02 22:33:06 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2019-12-02 22:33:06 +0100 |
commit | 3a0bd58fac55e8cdd4c2674bf10ca6998337236a (patch) | |
tree | f0c60e9477184eb1365fc89d2a98acf3dd055a29 /gcc/cp | |
parent | 871a8fab25b34ed43de1fd38ae0291e17ef53d1b (diff) | |
download | gcc-3a0bd58fac55e8cdd4c2674bf10ca6998337236a.zip gcc-3a0bd58fac55e8cdd4c2674bf10ca6998337236a.tar.gz gcc-3a0bd58fac55e8cdd4c2674bf10ca6998337236a.tar.bz2 |
re PR c++/92695 (P1064R0 - virtual constexpr fails if object taken from array)
PR c++/92695
* constexpr.c (cxx_eval_constant_expression) <case OBJ_TYPE_REF>: Use
STRIP_NOPS before checking for ADDR_EXPR.
* g++.dg/cpp2a/constexpr-virtual15.C: New test.
From-SVN: r278912
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/constexpr.c | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3a6bf05..9ca25ae 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2019-12-02 Jakub Jelinek <jakub@redhat.com> + + PR c++/92695 + * constexpr.c (cxx_eval_constant_expression) <case OBJ_TYPE_REF>: Use + STRIP_NOPS before checking for ADDR_EXPR. + 2019-11-29 Jakub Jelinek <jakub@redhat.com> PR c++/60228 diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index ee3ccb9..cc3ef10 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -5548,6 +5548,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t, tree obj = OBJ_TYPE_REF_OBJECT (t); obj = cxx_eval_constant_expression (ctx, obj, lval, non_constant_p, overflow_p); + STRIP_NOPS (obj); /* We expect something in the form of &x.D.2103.D.2094; get x. */ if (TREE_CODE (obj) != ADDR_EXPR || !DECL_P (get_base_address (TREE_OPERAND (obj, 0)))) |