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
+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
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))))
+2019-12-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/92695
+ * g++.dg/cpp2a/constexpr-virtual15.C: New test.
+
2019-12-02 Richard Sandiford <richard.sandiford@arm.com>
PR middle-end/92741
--- /dev/null
+// PR c++/92695
+// { dg-do compile { target c++2a } }
+
+struct A { virtual int get() = 0; };
+struct B : A { constexpr int get() override { return 10; } };
+struct D { B b[2]; A* c{&(b[0])}; };
+static_assert(D{}.c->get() == 10);