c++: Give more expressions locations.
authorJason Merrill <jason@redhat.com>
Tue, 24 Mar 2020 22:25:17 +0000 (18:25 -0400)
committerJason Merrill <jason@redhat.com>
Tue, 24 Mar 2020 22:25:17 +0000 (18:25 -0400)
commit6e771c087b10d5b730240ea35478eab8694c9c5d
tree4e040af85a82560387410b4b8c76ab46f9334b28
parent07f8bcc6ea9f3c0850a56a7431d866178d5cee92
c++: Give more expressions locations.

In the testcase for PR94186, we have a SCOPE_REF with no location even
though at one point it was in a cp_expr which had a location.  So let's make
the cp_expr constructor that takes a location apply it to the expression
when possible.

gcc/cp/ChangeLog
2020-03-24  Jason Merrill  <jason@redhat.com>

* cp-tree.h (cp_expr): When constructing from an expr and a
location, call protected_set_expr_location.
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/testsuite/g++.dg/ext/stmtexpr15.C
gcc/testsuite/g++.dg/parse/error26.C
gcc/testsuite/g++.dg/warn/Wnoexcept1.C