Commit 6a3ebcc6 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/88110 (ICE (segfault) with -std=C++2a in cxx_eval_constant_expression…

re PR c++/88110 (ICE (segfault) with -std=C++2a in cxx_eval_constant_expression when trying to evaluate nonoverridden "virtual ... = 0" function of a base class)

	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.

	* g++.dg/cpp2a/constexpr-virtual13.C: New test.

From-SVN: r266329
parent 260a9933
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> 2018-11-19 Marek Polacek <polacek@redhat.com>
PR c++/87781 - detect invalid elaborated-type-specifier. PR c++/87781 - detect invalid elaborated-type-specifier.
......
...@@ -4815,7 +4815,8 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t, ...@@ -4815,7 +4815,8 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
obj = cxx_eval_constant_expression (ctx, obj, lval, non_constant_p, obj = cxx_eval_constant_expression (ctx, obj, lval, non_constant_p,
overflow_p); overflow_p);
/* We expect something in the form of &x.D.2103.D.2094; get x. */ /* 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) if (!ctx->quiet)
error_at (cp_expr_loc_or_loc (t, input_location), error_at (cp_expr_loc_or_loc (t, input_location),
......
2018-11-20 Jakub Jelinek <jakub@redhat.com> 2018-11-20 Jakub Jelinek <jakub@redhat.com>
PR c++/88110
* g++.dg/cpp2a/constexpr-virtual13.C: New test.
PR tree-optimization/87895 PR tree-optimization/87895
* gcc.dg/gomp/pr87895-1.c: New test. * gcc.dg/gomp/pr87895-1.c: New test.
* gcc.dg/gomp/pr87895-2.c: New test. * gcc.dg/gomp/pr87895-2.c: New test.
......
// 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 ())
;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment