diff mbox series

[08/14] cp/tree.c: strip location wrappers in lvalue_kind

Message ID 1510350329-48956-9-git-send-email-dmalcolm@redhat.com
State New
Headers show
Series Preserving locations for variable-uses and constants (PR 43486) | expand

Commit Message

David Malcolm Nov. 10, 2017, 9:45 p.m. UTC
Without this, then lvalue_p returns false for decls, and hence
e.g. uses of them for references fail.

Stripping location wrappers in lvalue_kind restores the correct
behavior of lvalue_p etc.

gcc/cp/ChangeLog:
	* tree.c (lvalue_kind): Strip any location wrapper.
---
 gcc/cp/tree.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jason Merrill Dec. 11, 2017, 11:39 p.m. UTC | #1
On 11/10/2017 04:45 PM, David Malcolm wrote:
> Without this, then lvalue_p returns false for decls, and hence
> e.g. uses of them for references fail.
> 
> Stripping location wrappers in lvalue_kind restores the correct
> behavior of lvalue_p etc.
> 
> gcc/cp/ChangeLog:
> 	* tree.c (lvalue_kind): Strip any location wrapper.

Rather, lvalue_kind should learn to handle VIEW_CONVERT_EXPR.

Jason
diff mbox series

Patch

diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index b63f2ae..28ff7de 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -56,6 +56,8 @@  lvalue_kind (const_tree ref)
   cp_lvalue_kind op1_lvalue_kind = clk_none;
   cp_lvalue_kind op2_lvalue_kind = clk_none;
 
+  STRIP_ANY_LOCATION_WRAPPER (ref);
+
   /* Expressions of reference type are sometimes wrapped in
      INDIRECT_REFs.  INDIRECT_REFs are just internal compiler
      representation, not part of the language, so we have to look