aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2020-03-24 18:25:17 -0400
committerJason Merrill <jason@redhat.com>2020-03-24 18:25:17 -0400
commit6e771c087b10d5b730240ea35478eab8694c9c5d (patch)
tree4e040af85a82560387410b4b8c76ab46f9334b28 /gcc/cp
parent07f8bcc6ea9f3c0850a56a7431d866178d5cee92 (diff)
downloadgcc-6e771c087b10d5b730240ea35478eab8694c9c5d.zip
gcc-6e771c087b10d5b730240ea35478eab8694c9c5d.tar.gz
gcc-6e771c087b10d5b730240ea35478eab8694c9c5d.tar.bz2
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.
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/cp-tree.h5
2 files changed, 9 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 59db03c..7ae4128 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+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.
+
2020-03-23 Patrick Palka <ppalka@redhat.com>
PR c++/93805
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 0783b31..4e1d0f1 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -59,7 +59,10 @@ public:
m_value (value), m_loc (cp_expr_location (m_value)) {}
cp_expr (tree value, location_t loc):
- m_value (value), m_loc (loc) {}
+ m_value (value), m_loc (loc)
+ {
+ protected_set_expr_location (value, loc);
+ }
/* Implicit conversions to tree. */
operator tree () const { return m_value; }