+2018-11-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/88110
+ * constexpr.c (cxx_eval_constant_expression) <case OBJ_TYPE_REF>: Punt
+ if get_base_address of ADDR_EXPR operand is not a DECL_P.
+
2018-11-19 Marek Polacek <polacek@redhat.com>
PR c++/87781 - detect invalid elaborated-type-specifier.
obj = cxx_eval_constant_expression (ctx, obj, lval, non_constant_p,
overflow_p);
/* We expect something in the form of &x.D.2103.D.2094; get x. */
- if (TREE_CODE (obj) != ADDR_EXPR)
+ if (TREE_CODE (obj) != ADDR_EXPR
+ || !DECL_P (get_base_address (TREE_OPERAND (obj, 0))))
{
if (!ctx->quiet)
error_at (cp_expr_loc_or_loc (t, input_location),
2018-11-20 Jakub Jelinek <jakub@redhat.com>
+ PR c++/88110
+ * g++.dg/cpp2a/constexpr-virtual13.C: New test.
+
PR tree-optimization/87895
* gcc.dg/gomp/pr87895-1.c: New test.
* gcc.dg/gomp/pr87895-2.c: New test.
--- /dev/null
+// PR c++/88110
+// { dg-do compile }
+
+struct A {
+ virtual int foo () const = 0;
+};
+struct B {
+ virtual int bar () const = 0;
+ virtual int baz () const = 0;
+};
+struct C : public A { };
+struct D : public C { };
+struct E : public D, public B { };
+
+void
+qux (const E *x)
+{
+ if (x->baz ())
+ ;
+}