On Tue, Jan 09, 2018 at 10:30:31AM -0500, Jason Merrill wrote: > On Mon, Jan 8, 2018 at 6:55 PM, Jakub Jelinek <ja...@redhat.com> wrote: > > The assert there assumes we never evaluate a statement list to > > DEBUG_BEGIN_STMT, but it breaks appart when a BIND_EXPR with a typedef in it > > has some DEBUG_BEGIN_STMTs in it and nothing else (without -g it is just > > empty STATEMENT_LIST inside of the BIND_EXPR). We want to return void_node > > in that case. > > > > THere is nothing interesting about DEBUG_BEGIN_STMT for constexpr > > evaluation, it doesn't change any values, so let's just ignore them > > and the assert is then unnecessary. > > What if we return void_node for a DEBUG_BEGIN_STMT from > cxx_eval_constant_expression?
That would handle differently the case when some non-DEBUG_BEGIN_STMT is followed by one or more DEBUG_BEGIN_STMTs. In that case, with -g0 it would return the last stmt in the list, while with -g it would return void_node. I don't have a testcase for that right now, but given e.g. earlier reports from Alex that DEBUG_BEGIN_STMTs appear virtually everywhere, I can't prove it can't happen. Jakub