From 442c4003f392305636769a94843dbc092f045a40 Mon Sep 17 00:00:00 2001 From: jakub Date: Tue, 9 Jan 2018 21:21:03 +0000 Subject: [PATCH] PR c++/83734 * constexpr.c (cxx_eval_statement_list): Ignore DEBUG_BEGIN_STMTs in STATEMENT_LIST. Remove unneeded assert. * g++.dg/cpp0x/pr83734.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@256397 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/constexpr.c | 10 ++-------- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp0x/pr83734.C | 6 ++++++ 4 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr83734.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 73a31dfcf75..54860dc278e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-01-09 Jakub Jelinek + + PR c++/83734 + * constexpr.c (cxx_eval_statement_list): Ignore DEBUG_BEGIN_STMTs + in STATEMENT_LIST. Remove unneeded assert. + 2018-01-03 Richard Sandiford Alan Hayward David Sherwood diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index c91ca960df4..b216e090b45 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -3851,6 +3851,8 @@ cxx_eval_statement_list (const constexpr_ctx *ctx, tree t, for (i = tsi_start (t); !tsi_end_p (i); tsi_next (&i)) { tree stmt = tsi_stmt (i); + if (TREE_CODE (stmt) == DEBUG_BEGIN_STMT) + continue; r = cxx_eval_constant_expression (ctx, stmt, false, non_constant_p, overflow_p, jump_target); @@ -3859,14 +3861,6 @@ cxx_eval_statement_list (const constexpr_ctx *ctx, tree t, if (returns (jump_target) || breaks (jump_target)) break; } - /* Make sure we don't use the "result" of a debug-only marker. That - would be wrong. We should be using the result of the previous - statement, or NULL if there isn't one. In practice, this should - never happen: the statement after the marker should override the - result of the marker, so its value shouldn't survive in R. Now, - should that ever change, we'll need some fixing here to stop - markers from modifying the generated executable code. */ - gcc_checking_assert (!r || TREE_CODE (r) != DEBUG_BEGIN_STMT); return r; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4515cfa1f89..7d148177c29 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-01-09 Jakub Jelinek + + PR c++/83734 + * g++.dg/cpp0x/pr83734.C: New test. + 2017-01-09 Carl Love * gcc.target/powerpc/builtins-1.c (main): Add tests for vec_mergee and diff --git a/gcc/testsuite/g++.dg/cpp0x/pr83734.C b/gcc/testsuite/g++.dg/cpp0x/pr83734.C new file mode 100644 index 00000000000..958c2e962fd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr83734.C @@ -0,0 +1,6 @@ +// PR c++/83734 +// { dg-do compile { target c++11 } } +// { dg-options "-g -O2" } + +struct A { constexpr A () { typedef int T; } }; +A a; -- 2.11.4.GIT